473,406 Members | 2,451 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

frame scroll problem


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
Jul 18 '05 #1
1 4683
idriss <me*********@dbforums.com> wrote in message news:<30****************@dbforums.com>...
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
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Boniface Frederic | last post by:
Hello, I have frame displaying the last posted messages. I set <meta http-equiv="refresh" content="5"/> to automatically refresh the frame every 5s My problem is; if I scroll the frame to see...
0
by: Toph | last post by:
Bonjour a tous, Hi, I am developing a software in Python using Tkinter. The choice of my team is not to use pyton MegaWidgets. I would like to scroll a frame. This is a peace of my code : #...
1
by: Toph | last post by:
Hi, I am developing a software in Python using Tkinter. The choice of my team is not to use pyton MegaWidgets. I would like to scroll a frame. This is a peace of my code : #...
12
by: Flat Earth | last post by:
OK, I don't like frames either. That said, they do some things that I don't know how to do any other way. I edit a magazine at www.mississippireview.com that i just changed by putting an...
9
by: Roberto | last post by:
Hi everyone, I'm new here... I have a frameset header/contents. It's necessary to force the header's scrollbar to be visible to preserve the alignment between the two frames (see...
2
by: Fokke Nauta | last post by:
Hi all. I have a simple frame set (frame.htm) with a header and a main page. The header (header.htm) contains 2 buttons: scroll-up and scroll-down. The main page (main.htm) contains text only....
2
by: RC | last post by:
When you have a large table, you have to scroll the vertical and/or horizontal scroll bar(s) to read the table contents <td> tag. But the problem is you can't see the column header <th> tag when...
9
by: Stan Brown | last post by:
I've searched Google and the group archives, and came up empty, but maybe I just haven't selected the right search term. This concerns only the screen -- printing isn't an issue. I'm also not...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.