의심 할 바없이 이것은 초보자 용 질문입니다. Python 2.7에서 Tkinter의 그리드 레이아웃 관리자를 사용하고 있습니다. 클릭시 목록 상자를 숨기는 버튼을 원합니다. 여기 내 코드는 지금까지의 :그리드 레이아웃이있는 Tkinter 리프트 및 로우 메서드
는from Tkinter import *
root = Tk()
frame = Frame(root)
pyList = ["Eric", "Terry", "Graham", "Terry", "John", "Carol?", "Michael"]
arbList = ['ham', 'spam', 'eggs', 'potatos', 'tots', 'home fries']
pythons = Listbox(frame, width=10, height=5, selectmode=EXTENDED, exportselection=0)
food = Listbox(frame, width=10, height=5, selectmode=EXTENDED, exportselection=0)
def hider():
if pythons.selection_includes(4):
food.lower()
elif pythons.selection_includes(0):
food.lift()
b2 = Button(frame, text="Hide!", command=hider)
b2.grid(row=2, column=1)
food.grid(row=0, column=1)
pythons.grid(row=1, column=1, pady=10)
frame.grid()
for python in pyList:
pythons.insert('end', python)
for thing in arbList:
food.insert('end', thing)
root.mainloop()
불행하게도,이로 돌아온다 것은 내가/리프트 내 프레임 위 또는 아래에 내 목록 상자를 낮출 수 없다는 오류가 발생 나타납니다. pack() 관리자를 사용하지만 grid()는 사용할 수 없습니다.
무엇이 누락 되었습니까?
와우, 그 것이 아름답게 작동했습니다. 나는 그것이 단순한 무엇인지 알았다. 나는 형제 자매와 부모에게 충분한 생각을하지 않은 것 같아요. 도와 주셔서 감사합니다! – JMarotta