⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ liste des attributs
tkinter.compound
⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ liste des attributs
tkinter.compound
DESCRIPTION.
Définit ou retourne la position de l'image, par rapport au texte, dans le controle.
SYNTAXE.
compound = position
REMARQUES.
position doit être un str ( ) représentant une position valide. Les positions valides sont :
"bottom" : l'image est placée au dessous du texte ;
"center" : l'image est placée sous le texte puis le tout est centré ;
"left" : l'image est placée à gauche du texte ;
"right" : l'image est placée à droite du texte ;
"top" : l'image est placée au dessus du texte.
EXEMPLE.
import tkinter , tkinter.filedialog
def FNC_Chargemment ( ) :
ktypes = [ ( "image gif" , ".gif" ) , ( "image pgm" , ".pgm" ) , ( "image ppm" , ".ppm" ) ]
kfichier = tkinter.filedialog.askopenfilename ( title = "Sélectionnez" , filetypes = ktypes )
if len ( kfichier ) < 1 : return
IMG_Image [ "file" ] = kfichier
def FNC_Deplacer ( Q ) :
BUT_Charger [ "compound" ] = Q
TKI_Principal = tkinter.Tk ( )
IMG_Image = tkinter.PhotoImage ( )
BUT_Quitter = tkinter.Button ( TKI_Principal , text = "Quitter" , command = TKI_Principal.destroy )
BUT_Charger = tkinter.Button ( TKI_Principal , text = "Charger une image" , image = IMG_Image , command = FNC_Chargemment )
BUT_Gauche = tkinter.Button ( TKI_Principal , text = "left" , command = lambda : FNC_Deplacer ( "left" ) )
BUT_Droite = tkinter.Button ( TKI_Principal , text = "right" , command = lambda : FNC_Deplacer ( "right" ) )
BUT_Haut = tkinter.Button ( TKI_Principal , text = "top" , command = lambda : FNC_Deplacer ( "top" ) )
BUT_Bas = tkinter.Button ( TKI_Principal , text = "bottom" , command = lambda : FNC_Deplacer ( "bottom" ) )
BUT_Centre = tkinter.Button ( TKI_Principal , text = "center" , command = lambda : FNC_Deplacer ( "center" ) )
BUT_Charger.grid ( row = 0 , column = 0 , columnspan = 3 , sticky = "nesw" )
BUT_Quitter.grid ( row = 0 , column = 4 , rowspan = 4 , sticky = "nesw" )
BUT_Haut.grid ( row = 1 , column = 1 , sticky = "nesw" )
BUT_Gauche.grid ( row = 2 , column = 0 , sticky = "nesw" )
BUT_Centre.grid ( row = 2 , column = 1 , sticky = "nesw" )
BUT_Droite.grid ( row = 2 , column = 2 , sticky = "nesw" )
BUT_Bas.grid ( row = 3 , column = 1 , sticky = "nesw" )
FNC_Deplacer ( "center" )
TKI_Principal.mainloop ( )
Votre aide est précieuse pour améliorer ce site, alors n'hésitez pas à faire part de