Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > [ python-list ] scrolling a frame

Reply
Thread Tools

[ python-list ] scrolling a frame

 
 
Toph
Guest
Posts: n/a
 
      12-02-2003


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/env python
from Tkinter import *

root = Tk()
global_frame = Frame(root, relief = GROOVE, borderwidth=4)
canvas = Canvas(global_frame)

# scrollbars:
vscroll = Scrollbar(global_frame, command=canvas.yview)
hscroll = Scrollbar(global_frame, command=canvas.xview, orient=HORIZONTAL)

# The frame i want to scroll :
frame = Frame(canvas, relief = GROOVE, borderwidth=2)
cw = canvas.create_window(0,0, window = frame)

global_frame.grid(row = 0, column = 0, sticky=NS)

#put the widgets in global_frame
canvas.grid(row = 0, column = 0)
vscroll.grid(row = 0, column = 1, sticky=NS)
hscroll.grid(row = 1, column = 0, sticky=EW)

# fill the frame :
for item in range(30):
Label(frame, text = 'item %d'%item).grid(row = item,
column = 0)
Entry(frame, text = 'default text %d'%item).grid(row = item,
column = 1, sticky=EW)

# configure the scollbars to scroll the canvas :
hauteur = frame.winfo_height()
largeur = frame.winfo_width()
canvas.configure(yscrollcommand = vscroll.set, xscrollcommand = hscroll.set,
scrollregion = (0,0, largeur, hauteur)) #canvas.coords(cw))

# My problem is that i would like the scrollregion to scroll only the space taken by
# the frame but my program does not do it well...

root.mainloop()
#------------------------------------------------------------------------------

I thank you in advance.

Christophe

Accédez au courrier électronique de La Poste : www.laposte.net ;
3615 LAPOSTENET (0,34€/mn) ; tél : 08 92 68 13 50 (0,34€/mn)


 
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
smooth scrolling & auto scrolling sillyputty Firefox 1 08-24-2007 02:10 AM
frame and horizontal scrolling (IE) onzinnig@chello.nl HTML 0 06-30-2006 03:10 PM
Changing scrolling property for a frame Christopher Benson-Manica Javascript 2 05-20-2005 06:38 AM
Wanted: Javascript for scrolling in another frame Fokke Nauta Javascript 2 05-30-2004 08:37 AM
[ python-l ] scrolling a frame Toph Python 1 12-04-2003 07:49 PM



Advertisments