2
나는 예를 들어 Class menu in Tkinter Gui 다음에 나오는 Tkinter 응용 프로그램을 시작하려고하지만, 예를 들면 다음과 같은 기능도 추가하려고합니다. 버튼 바, RadioButton 구성 바, 등과 같은 뭔가 :메뉴, 버튼 등. Tkinter GUI의 바
from Tkinter import *
def clickTest():
print "Click!"
class App(Tk):
def __init__(self):
Tk.__init__(self)
menuBar = MenuBar(self)
buttonBar = ButtonBar(self)
self.config(menu=menuBar)
buttonBar.grid(row=0, column=0) ???
class MenuBar(Menu):
def __init__(self, parent):
Menu.__init__(self, parent)
fileMenu = Menu(self, tearoff=False)
self.add_cascade(label="File", menu=fileMenu)
fileMenu.add_command(label="Exit", command=clickTest)
class ButtonBar(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
firstButton = Button(parent, text="1st Button", command=clickTest)
secondButton = Button(parent, text="2nd Button", command=clickTest)
if __name__ == "__main__":
app = App()
app.mainloop()
하지만이 같은 창에 표시하기 위해이 모든 것을 얻는 방법을 모르겠어요. 물론,있는 그대로의 코드는 작동하지 않습니다. 모든 제안을 부탁드립니다. 감사!
차가움. 감사. 네, 방금 그리드 (grid)로 알아 냈습니다. 버튼의 부모에 대한 마지막 제안을 주셔서 감사합니다. – Ryan