저는이 문제에 대한 답변을 찾기 위해 여러 해 동안 스택 오버플로를 조사해 왔지만 작동 할 수있는 것이 아무것도 없으므로이 질문을하고 있습니다. 저는 세 개의 버튼과 레이블이있는 작은 프로그램을 가지고 있으며, 그리드에 있습니다. 나는 버튼이나 라벨의 크기 나 모양이 프레임에 비례해서 어떻게 유지 될지 궁금해하고있었습니다. 이미지 크기를 조정 한 것과 마찬가지로 모든 것이 같은 크기로 유지됩니다. 대답은 분명하다파이썬 3.6 - 프레임 크기에 따라 Tkinter 버튼의 크기를 조절합니다.
from tkinter import *
class Window(Frame): #All the stuff for the GUI
def __init__(self, master = None):
Frame.__init__(self, master)
self.master = master
self.init_window()
self.grid()
def init_window(self):
self.master.title("EncryptDecrypt")
self.pack(fill = BOTH, expand = 1)
quitButton = Button(self, text = "Quit", command = self.client_exit, width = 10, height = 5) #Quit Button
quitButton.grid(row = 0, column = 0, sticky = W)
encryptModeButton = Button(self, text = "Encrypt", command = lambda: self.execute("decrypted.txt", "encrypted.txt", 1, 0), width = 10, height = 5) #Encrypt Button
encryptModeButton.grid(row = 0, column = 1, sticky = W)
decryptModeButton = Button(self, text = "Decrypt", command = lambda: self.execute("encrypted.txt", "decrypted.txt", 0, 1), width = 10, height = 5) #Decrypt button
decryptModeButton.grid(row = 0, column = 2, sticky = W)
myLabel = Label(self, text = "Select The Action You Wish To Undertake", font = ("Purisa", 15))
myLabel.grid(row = 0, column = 3)
root = Tk()
root.geometry("610x80")
app = Window(root)
root.mainloop()
죄송 경우, 이미
난 당신이 요구하는지 확실히 모르겠어요. 창 크기를 더 크게 조정하면 모든 것이 성장하기를 원한다는 말입니까? –
@BryanOakley 네 맞습니다. –