Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > frame scroll problem

Reply
Thread Tools

frame scroll problem

 
 
idriss
Guest
Posts: n/a
 
      06-23-2003

i want to scroll one frame's or canvas 's whole content (it will contain
other subframes and subframes will contain bitmaps) I couldn't find
where is my fault. if you can find my fault or have some example codes
like this please help me thanks from now.....



from Tkinter import *
import Image, ImageTk


root = Tk()

mainFrame = Canvas(root,width=400, height=420, bg='gray50',relief=RIDGE)
mainFrame.pack(fill=BOTH,expand=1)

scroll = Scrollbar(mainFrame)
scroll.pack(side=RIGHT,expand=1,fill=BOTH)

mainFrame.configure(xscrollcommand=scroll.set)


subFrame = Frame(mainFrame,width=200,height=300)
subFrame.pack(expand=1,fill=BOTH)

picNo =0
img = []

# two picture placed side by side
imgfile = 'c:\untitled.bmp'
lbl = Label(subFrame, bd=0)
lbl.place(anchor=NW)
masterImg = Image.open(imgfile)
masterImg.thumbnail((500, 500))
img.append(ImageTk.PhotoImage(masterImg))
lbl['image'] = img[picNo]
picNo = picNo + 1
lbl.pack(side=LEFT)

imgfile = 'c:\untitled.bmp'
lbl = Label(subFrame, bd=0)
lbl.place(anchor=NW)
masterImg = Image.open(imgfile)
masterImg.thumbnail((500, 500))
img.append(ImageTk.PhotoImage(masterImg))
lbl['image'] = img[picNo]
picNo = picNo + 1
lbl.pack(side=LEFT)
root.mainloop()

--
Posted via http://dbforums.com
 
Reply With Quote
 
 
 
 
Peter Abel
Guest
Posts: n/a
 
      06-24-2003
idriss <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> i want to scroll one frame's or canvas 's whole content (it will contain
> other subframes and subframes will contain bitmaps) I couldn't find
> where is my fault. if you can find my fault or have some example codes
> like this please help me thanks from now.....
>
>
>
> from Tkinter import *
> import Image, ImageTk
>
>
> root = Tk()
>
> mainFrame = Canvas(root,width=400, height=420, bg='gray50',relief=RIDGE)
> mainFrame.pack(fill=BOTH,expand=1)
>
> scroll = Scrollbar(mainFrame)
> scroll.pack(side=RIGHT,expand=1,fill=BOTH)
>
> mainFrame.configure(xscrollcommand=scroll.set)
>
>
> subFrame = Frame(mainFrame,width=200,height=300)
> subFrame.pack(expand=1,fill=BOTH)
>
> picNo =0
> img = []
>
> # two picture placed side by side
> imgfile = 'c:\untitled.bmp'
> lbl = Label(subFrame, bd=0)
> lbl.place(anchor=NW)
> masterImg = Image.open(imgfile)
> masterImg.thumbnail((500, 500))
> img.append(ImageTk.PhotoImage(masterImg))
> lbl['image'] = img[picNo]
> picNo = picNo + 1
> lbl.pack(side=LEFT)
>
> imgfile = 'c:\untitled.bmp'
> lbl = Label(subFrame, bd=0)
> lbl.place(anchor=NW)
> masterImg = Image.open(imgfile)
> masterImg.thumbnail((500, 500))
> img.append(ImageTk.PhotoImage(masterImg))
> lbl['image'] = img[picNo]
> picNo = picNo + 1
> lbl.pack(side=LEFT)
> root.mainloop()


See http://effbot.org/zone/tkinter-autoscrollbar.htm .
There's an example of automatic Scrollbars, which are removed when
not needed. Further more there's described how to scroll a Canvas
widget with subwidgets on it.
Regards
Peter
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Enable Scroll up and scroll down in CR-report Sathiamoorthy ASP .Net 1 11-28-2006 11:42 PM
Listbox disabled - cant scroll in IE - can scroll in Firefox =?Utf-8?B?Ui5OaWprYW1w?= ASP .Net 0 11-22-2006 03:46 PM
Using a div with scroll bars - can we get the scroll bars on the left instead of the right side? UJ ASP .Net 1 11-01-2006 09:32 PM
change the scroll speed of a scroll pane? Kevin Java 1 02-05-2005 09:42 AM
prevent mouse scroll to scroll in a dropdownlist nicholas ASP .Net 0 12-07-2004 11:26 AM



Advertisments