2012-12-24 4 views
0

나는 파이썬에서 항목을 스크롤하려고합니다. 프로그램을 실행할 때 아무 일도 일어나지 않습니다. 제발 도와주세요 ??파이썬에서 항목 위젯 스크롤

self.scrollbar = tk.Scrollbar(self,orient="horizontal") 
self.e3 =tk.Entry(self,xscrollcommand=self.scrollbar.set) 
self.e3.focus() 
self.e3.pack(side="bottom",fill="x") 
#self.e3.grid(row=10, column=7) 
self.scrollbar.pack(fill="x") 
self.scrollbar.config(command=self.e3.xview) 
self.e3.config() 

답변

0

귀하의 코드, 그냥 모든 "자기"를 삭제 작동합니다

이 내 코드입니다. "self"라는 단어는 일반적으로 클래스에서 사용됩니다 ("바나나"와 같이 바꿀 수 있음). 다음은 몇 가지 설명을 찾을 수 있습니다

What is the purpose of self?

근무 코드 :

import tkinter as tk 
scrollbar = tk.Scrollbar(orient="horizontal") 
e3 =tk.Entry(xscrollcommand=scrollbar.set) 
e3.focus() 
e3.pack(side="bottom",fill="x") 
#e3.grid(row=10, column=7) 
scrollbar.pack(fill="x") 
scrollbar.config(command=e3.xview) 
e3.config() 

@EDIT을 : 마지막 줄을 (e3.config는()) 필요 - 그것은 아무것도하지 않는다.