Question

Is there any way of getting a scroll bar using the easygui module or a modified version of it? I found a file online called thinking_py.txt, and, after converting it to python format, found that it did indeed have a version of easygui with a scroll-bar. However, according to the launcher, at least, the module is rife with syntax errors. I don't want to mess around with it too much, so what can I do?

Was it helpful?

Solution

Probably you refer to the application thinking.py from Steve Ferg which is part of his work Thinking in Tkinter.

I just downloaded it and works like a charm.

Not sure what the problem is, but I would not keep putting the blame on Ferg's syntax errors. Consequently, my advice to your question is you to take some time and learn tkinter. You can do it using the very same Thinking in Tkinter you already have.

Forget EasyGui, it is a wrapper of tkinter that, for the shake of simplicity, is stealing from you basic things like the capacity of selecting the size of your frame, the very first thing one want to do with a frame that occupies most of the screen.

In Ferg's site there are also other interesting links for learning tkinter.

Finally, this is what you need for a scrollbar in a text control:

from Tkinter import *

root = Tk()

scrollbar = Scrollbar(root)
scrollbar.pack(side=RIGHT, fill=Y)

text = Text(root, wrap=WORD, yscrollcommand=scrollbar.set)
text.pack()

data = 'I will study some tkinter\n'
for i in range(100):
    text.insert(END, data)

scrollbar.config(command=text.yview)

mainloop()

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top