The Artima Developer Community
Sponsored Link

Python Answers Forum
Scrolled Canvas problem!!!

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Katie

Posts: 1
Nickname: buttercup2
Registered: Jul, 2004

Scrolled Canvas problem!!! Posted: Jul 8, 2004 10:34 AM
Reply to this message Reply
Advertisement
I'm trying to get the scrollbar to allow me to scroll over a set of listboxes on a canvas. The scrollbar will appear there correctly, but when I resize the window so that all the listboxes do not fit on the screen, i'm not allowed to scroll to view the rest. I'm at a loss for what I should try - Here's a snipet of code that's almost identical to what I'm doing - can anyone see where I've gone wrong?


from Tkinter import *

list1 = [1,2,3]
list2 = ["element1", "element2", "element3"]
list3 = ["testing", "1", "2", "3"]

list_set = [list1, list2, list3]

root = Tk()

root_frame = Frame(root)
root_frame.pack()

canvas = Canvas(root_frame, height=500, width=1000, bg="white", relief=RIDGE, bd=3)

for list in list_set:
frame = Frame(canvas, width=20); frame.pack(side=LEFT)
listbox = Listbox(frame)
listbox.pack()
listbox.insert(0,list)
frame.pack()

sbh = Scrollbar(root_frame, orient='horizontal')
sbh.pack(side=BOTTOM, fill=X)


# bind listbox to scrollbar
canvas.config(xscrollcommand=sbh.set)
sbh.config(command=canvas.xview )

canvas.pack()

root.mainloop()


Thanks in advance to anyone trying to help!!! I really do appreciate it.

Katie

Topic: Using socket over a firewall Previous Topic   Next Topic Topic: Need someone to help me write a program

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use