On a scrollbar for tkinter

E

eneskristo

Hello people!
I'm new to tkinter, but I have to use it for a program for a competition. So, I make a RadioButton program using a while loop. So far so good, fully working. BUT it didn't show the full content, even after maximising the window. So, my question is, how do I make a scroll bar(On x and y axis) for my Main Frame. I can provide additional info if needed.
Notes:
Python 3.2 (Using Portable Python for a while. Outdated but meh.)
Thank you in advance!
 
T

Terry Reedy

I'm new to tkinter, but I have to use it for a program for a competition. So, I make a RadioButton program using a while loop. So far so good, fully working. BUT it didn't show the full content, even after maximising the window. So, my question is, how do I make a scroll bar(On x and y axis) for my Main Frame. I can provide additional info if needed.

Have you already searched 'python tkinter scrollbar', with maybe
'example' added? Or looked at the links given in the library manual chapter?
 
E

eneskristo

@Teddy

Yes, indeed I have, but so far I have only found material for scrolling in other stuff, not the main frame. If you can give me a link...
 
R

Rick Johnson

I know you're using Python3.x, so there may be new functionality in Tkinter that i am not aware of yet. I still have oodles of Python2.x dependencies and really don't see a need to make the jump yet -- so keep that in mind when taking my advice below.

In the old days of Tkinter, if you wanted to scroll the mainframe (aka:root, aka:Tkinter.Tk) you had two choices:

OPTION_1. Use tk.Canvas and "create_window" method
http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/create_window.html

OPTION_2. The "TIX" extension widgets for Tkinter has a "scrolledwindow" object that requires much less work and provides a more intuitive interface than the canvas.

PS: It's "Terry" not "Teddy".
 
E

eneskristo

@Terry
Quite sorry but had to write that message in a hurry, didn't notice the name.

@Rick
I found some solutions for python 2.x, but still, as I am with the future, I need a futuristic solution or 2, so if anyone else could help me, I'd be grateful!
 
V

Vlastimil Brom

2014/1/3 said:
@Rick
I found some solutions for python 2.x, but still, as I am with the future, I need a futuristic solution or 2, so if anyone else could help me, I'd be grateful!
--

Hi,
I usually don't use tkinter myself, hence others may have more
idiomatic suggestions,
but you can of course use ScrolledWindow tix with python3; cf.:

from tkinter import tix

root = tix.Tk()
root.title("scrolled window")
root.geometry("50x500+50+50")
sw= tix.ScrolledWindow(root)
sw.pack(fill=tix.BOTH, expand=1)
for i in range(1,101):
cb = tix.Checkbutton(sw.window, text=str(i))
cb.pack(fill=tix.BOTH, expand=0)
root.mainloop()

hth,
vbr
 
E

eneskristo

Hi,

I usually don't use tkinter myself, hence others may have more

idiomatic suggestions,

but you can of course use ScrolledWindow tix with python3; cf.:



from tkinter import tix



root = tix.Tk()

root.title("scrolled window")

root.geometry("50x500+50+50")

sw= tix.ScrolledWindow(root)

sw.pack(fill=tix.BOTH, expand=1)

for i in range(1,101):

cb = tix.Checkbutton(sw.window, text=str(i))

cb.pack(fill=tix.BOTH, expand=0)

root.mainloop()



hth,

vbr

Thank you sir! It really helped!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,189
Members
46,735
Latest member
HikmatRamazanov

Latest Threads

Top