469,276 Members | 1,600 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,276 developers. It's quick & easy.

Scrolling an Entry widget on python

I try to make scrolling on an Entry in python.
when I run program nothing happen.
Please any one help me??

this is my code:

Expand|Select|Wrap|Line Numbers
  1. self.scrollbar = tk.Scrollbar(self,orient="horizontal")
  2.         self.e3 =tk.Entry(self,xscrollcommand=self.scrollbar.set)
  3.         self.e3.focus()
  4.         self.e3.pack(side="bottom",fill="x")
  5.         #self.e3.grid(row=10, column=7)
  6.         self.scrollbar.pack(fill="x")
  7.         self.scrollbar.config(command=self.e3.xview)
  8.         self.e3.config()
Dec 24 '12 #1
1 5626
dwblas
626 Expert 512MB
It works fine for me on Slackware Linux. Note that to scroll you have to have an entry that is wider than the box.
Expand|Select|Wrap|Line Numbers
  1. class TestEntry():
  2.     def __init__(self):
  3.             root = tk.Tk()
  4.             self.scrollbar = tk.Scrollbar(root,orient="horizontal")
  5.             txt = tk.StringVar()
  6.             self.e3 =tk.Entry(root,
  7.                      xscrollcommand=self.scrollbar.set,
  8.                      textvariable=txt)
  9.             txt.set("ABC"*10)  ## add some text to scroll
  10.             self.e3.focus()
  11.             self.e3.pack(side="bottom",fill="x")
  12.             self.scrollbar.pack(fill="x")
  13.             self.scrollbar.config(command=self.e3.xview)
  14.             self.e3.config()
  15.  
  16.             root.mainloop()
  17.  
  18. TestEntry() 
Dec 24 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Phil Schmidt | last post: by
5 posts views Thread by Otto Krüse | last post: by
2 posts views Thread by wanwan | last post: by
1 post views Thread by Arne | last post: by
reply views Thread by Marek S. | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.