0

i put a check button in a Frame. The "side" of the frame is right. I specify my check button to be on anchor 'center' but it goes on the right. Do you know how to solve this? Thank you

from tkinter import *

fenetre= Tk()
cadreoptions=Frame(fenetre,width=100,height=70,borderwidth=2)
cadreoptions.pack(side=RIGHT)

statusnegatif=IntVar()
negatifbutton= Checkbutton(cadreoptions,text='Négatif',variable=statusnegatif)
negatifbutton.pack(padx=5,pady=2,anchor='center')

fenetre.mainloop()
Elias
  • 77
  • 7

1 Answers1

1
from tkinter import *

fenetre= Tk()
cadreoptions=Frame(fenetre,width=100,height=70,borderwidth=2)
cadreoptions.pack(side=RIGHT,expand=1)

statusnegatif=IntVar()
negatifbutton= Checkbutton(cadreoptions,text='Négatif',variable=statusnegatif)
negatifbutton.pack(padx=5,pady=2)

fenetre.mainloop()

Your frame holding your label and where ever your frame is going the label will go with it. So expand=1 makes your frame resizing. The anchor is "center" by default, so it is not necessary.

more

Thingamabobs
  • 7,274
  • 5
  • 21
  • 54