我在框架中放置了一個復選按鈕??蚣艿摹皞让妗笔钦_的。我指定我的檢查按鈕位于錨點“中心”,但它位于右側。你知道如何解決這個問題嗎?謝謝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()
1 回答

繁星coding
TA貢獻1797條經驗 獲得超4個贊
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()
您的相框上裝有您的標簽,無論您的相框走到哪里,標簽都會隨之而去。所以expand=1會讓你的框架調整大小。錨點默認是“center”,所以沒有必要。
添加回答
舉報
0/150
提交
取消