Placement de bouton sur Tkinter
Fermé
Bonjour,
J'aimerai savoir comment est-il possible de placer un bouton en haut et à droite ( ou en haut à gauche) sur Tkinter. J'ai essayé avec .pack() mais il me semble qu'il ne prend qu'une seule information (LEFT ou BOTTOM...). j'aimerai savoir s'il est possible de résoudre mon problème simplement ?
J'aimerai savoir comment est-il possible de placer un bouton en haut et à droite ( ou en haut à gauche) sur Tkinter. J'ai essayé avec .pack() mais il me semble qu'il ne prend qu'une seule information (LEFT ou BOTTOM...). j'aimerai savoir s'il est possible de résoudre mon problème simplement ?
Configuration: Windows / Firefox 74.0
4 réponses
Bonjour Mathis,
Comme ça, par exemple:
# -*- coding:Latin-1 -*-
from tkinter import *
from tkinter import messagebox
def coucou():
messagebox.showinfo('coucou')
WIDTH=400
HEIGHT=150
main_win = Tk()
main_win.configure(background = 'azure')
main_win.title('Test widgets')
main_win.geometry(str(WIDTH)+'x'+str(HEIGHT)+'+300+100')
b1 = Button(main_win, text='Afficher', command=coucou)
b1.place(x = 320,y = 10)
main_win.mainloop()
Comme ça, par exemple:
# -*- coding:Latin-1 -*-
from tkinter import *
from tkinter import messagebox
def coucou():
messagebox.showinfo('coucou')
WIDTH=400
HEIGHT=150
main_win = Tk()
main_win.configure(background = 'azure')
main_win.title('Test widgets')
main_win.geometry(str(WIDTH)+'x'+str(HEIGHT)+'+300+100')
b1 = Button(main_win, text='Afficher', command=coucou)
b1.place(x = 320,y = 10)
main_win.mainloop()