473,811 Members | 2,190 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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,wid th=400, height=420, bg='gray50',rel ief=RIDGE)
mainFrame.pack( fill=BOTH,expan d=1)

scroll = Scrollbar(mainF rame)
scroll.pack(sid e=RIGHT,expand= 1,fill=BOTH)

mainFrame.confi gure(xscrollcom mand=scroll.set )
subFrame = Frame(mainFrame ,width=200,heig ht=300)
subFrame.pack(e xpand=1,fill=BO TH)

picNo =0
img = []

# two picture placed side by side
imgfile = 'c:\untitled.bm p'
lbl = Label(subFrame, bd=0)
lbl.place(ancho r=NW)
masterImg = Image.open(imgf ile)
masterImg.thumb nail((500, 500))
img.append(Imag eTk.PhotoImage( masterImg))
lbl['image'] = img[picNo]
picNo = picNo + 1
lbl.pack(side=L EFT)

imgfile = 'c:\untitled.bm p'
lbl = Label(subFrame, bd=0)
lbl.place(ancho r=NW)
masterImg = Image.open(imgf ile)
masterImg.thumb nail((500, 500))
img.append(Imag eTk.PhotoImage( masterImg))
lbl['image'] = img[picNo]
picNo = picNo + 1
lbl.pack(side=L EFT)
root.mainloop()

--
Posted via http://dbforums.com
Jul 18 '05 #1
1 4709
idriss <me*********@db forums.com> wrote in message news:<30******* *********@dbfor ums.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,wid th=400, height=420, bg='gray50',rel ief=RIDGE)
mainFrame.pack( fill=BOTH,expan d=1)

scroll = Scrollbar(mainF rame)
scroll.pack(sid e=RIGHT,expand= 1,fill=BOTH)

mainFrame.confi gure(xscrollcom mand=scroll.set )
subFrame = Frame(mainFrame ,width=200,heig ht=300)
subFrame.pack(e xpand=1,fill=BO TH)

picNo =0
img = []

# two picture placed side by side
imgfile = 'c:\untitled.bm p'
lbl = Label(subFrame, bd=0)
lbl.place(ancho r=NW)
masterImg = Image.open(imgf ile)
masterImg.thumb nail((500, 500))
img.append(Imag eTk.PhotoImage( masterImg))
lbl['image'] = img[picNo]
picNo = picNo + 1
lbl.pack(side=L EFT)

imgfile = 'c:\untitled.bm p'
lbl = Label(subFrame, bd=0)
lbl.place(ancho r=NW)
masterImg = Image.open(imgf ile)
masterImg.thumb nail((500, 500))
img.append(Imag eTk.PhotoImage( masterImg))
lbl['image'] = img[picNo]
picNo = picNo + 1
lbl.pack(side=L EFT)
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
3711
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 messages up or down, after the refresh, the scroll position is reseted to the top of the frame and my scroll position is lost.
0
1940
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 : # ----------------------------------------------------------------------------- #!/bin/envpython from Tkinter import *
1
3157
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 : # ----------------------------------------------------------------------------- #!/bin/env python from Tkinterimport *
12
3954
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 INLINE FRAME in a table with an constant top and bottom. Anyway, I wanted to stabilize the page and drop the text (there are about 500 stories, poems, essays, etc online in MR) into this changing hole in the middle, as if it were on a "page."
9
7371
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 www.liceomichelangelo.it for details). <frame src="header.html scrolling="Yes"> doesn't work with Mozilla (this is a bug), so I caused the scrollbar to be present via css as follows: body{overflow: -moz-scrollbars-vertical;}
2
1548
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. When I click on the scroll-up button in the header, I want the main page to scroll up 13 lines. The same for scrolling down. Is there a javascript that can make another page scrolling? Thanks in advance.
2
2688
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 you scroll down the vertical scroll bar. So how do I make <th> tag always stay on the window/frame. This is similar to spreadsheet Excel, the scroll bars (vertical and horizontal) will not effect the column headers.
9
3074
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 concerned about the appearance of the page in IE6 as long as the page is still usable. I want to have two pseudo-frames, using only CSS and no JS. The top "frame", 4em high, is a menu, and I want it to stay at the top of the viewport. The rest...
0
9728
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10648
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10135
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9205
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7670
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5554
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4339
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3018
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.