I'm trying to get a scrollbar bound with a Frame, and I keep on getting
a scrollbar, but it doesn't actually scroll. Some help, please? 8 11861
BTW, experience tells me it is necessary for me to explicitly state
that I'm a newbie (otherwise I get rude people saying I should already
know such-and-such).
Dustan wrote: I'm trying to get a scrollbar bound with a Frame, and I keep on getting a scrollbar, but it doesn't actually scroll. Some help, please?
It can be tricky getting an empty frame to scroll, can you post your
example code so that we might be more helpful. Here is an example of
binding a scroll bar to a Text widget (not exactly the same thing)
## import all names from Tkinter
## bit naughty but I don't mind
from Tkinter import *
# root window
root=Tk()
# text area
text=Text()
text.pack(side="left", expand="yes", fill="both")
# scrolbar for above textarea
sb = Scrollbar(root)
sb.pack(side="right", fill="y")
## bind them both together...
# this line binds the yscrollcommand
# of the text area to the scrollbar set method
text['yscrollcommand'] = sb.set
# this line binds the scrollbars command to
# the yview method of the text area
sb['command'] = text.yview
# mainloop entry
root.mainloop()
Martin Franklin wrote: Dustan wrote: I'm trying to get a scrollbar bound with a Frame, and I keep on getting a scrollbar, but it doesn't actually scroll. Some help, please?
It can be tricky getting an empty frame to scroll, can you post your example code so that we might be more helpful. Here is an example of binding a scroll bar to a Text widget (not exactly the same thing)
It's not an empty frame. It has a label. I was trying to do it with
just the label, but it didn't work, and I figured it might be a better
idea to try doing it with a frame instead. ## import all names from Tkinter ## bit naughty but I don't mind from Tkinter import *
# root window root=Tk()
# text area text=Text() text.pack(side="left", expand="yes", fill="both")
# scrolbar for above textarea sb = Scrollbar(root) sb.pack(side="right", fill="y") ## bind them both together...
# this line binds the yscrollcommand # of the text area to the scrollbar set method text['yscrollcommand'] = sb.set
# this line binds the scrollbars command to # the yview method of the text area sb['command'] = text.yview # mainloop entry root.mainloop()
That doesn't help. I need to be able to do it either with a frame (has
content!) or a Text widget.
Dustan wrote: Martin Franklin wrote:
Dustan wrote:
I'm trying to get a scrollbar bound with a Frame, and I keep on getting a scrollbar, but it doesn't actually scroll. Some help, please?
It can be tricky getting an empty frame to scroll, can you post your example code so that we might be more helpful. Here is an example of binding a scroll bar to a Text widget (not exactly the same thing)
It's not an empty frame. It has a label. I was trying to do it with just the label, but it didn't work, and I figured it might be a better idea to try doing it with a frame instead.
## import all names from Tkinter ## bit naughty but I don't mind from Tkinter import *
# root window root=Tk()
# text area text=Text() text.pack(side="left", expand="yes", fill="both")
# scrolbar for above textarea sb = Scrollbar(root) sb.pack(side="right", fill="y") ## bind them both together...
# this line binds the yscrollcommand # of the text area to the scrollbar set method text['yscrollcommand'] = sb.set
# this line binds the scrollbars command to # the yview method of the text area sb['command'] = text.yview # mainloop entry root.mainloop()
That doesn't help. I need to be able to do it either with a frame (has content!) or a Text widget.
Perhaps I am not understanding something... can you please show me an
example of what is not working. I consider the above a good recipe that
can be applied to any scrollable widget in Tkinter.
hmm, a single change to my example (Text to Frame) produces this
traceback:-
C:/python24/python -u "quicksb.py"
Traceback (most recent call last):
File "quicksb.py", line 17, in ?
text['yscrollcommand'] = sb.set
File "C:\python24\lib\lib-tk\Tkinter.py", line 1146, in __setitem__
self.configure({key: value})
File "C:\python24\lib\lib-tk\Tkinter.py", line 1139, in configure
return self._configure('configure', cnf, kw)
File "C:\python24\lib\lib-tk\Tkinter.py", line 1130, in _configure
self.tk.call(_flatten((self._w, cmd)) + self._options(cnf))
_tkinter.TclError: unknown option "-yscrollcommand"Exit code: 1
and another change (Frame to Label) produces this traceback:-
C:/python24/python -u "quicksb.py"
Traceback (most recent call last):
File "quicksb.py", line 17, in ?
text['yscrollcommand'] = sb.set
File "C:\python24\lib\lib-tk\Tkinter.py", line 1146, in __setitem__
self.configure({key: value})
File "C:\python24\lib\lib-tk\Tkinter.py", line 1139, in configure
return self._configure('configure', cnf, kw)
File "C:\python24\lib\lib-tk\Tkinter.py", line 1130, in _configure
self.tk.call(_flatten((self._w, cmd)) + self._options(cnf))
_tkinter.TclError: unknown option "-yscrollcommand"Exit code: 1
This would suggest that the Frame and Label widgets are not scrollable
(at least not in the 'y' direction)
Cheers
Martin
In article <11*********************@g14g2000cwa.googlegroups. com>,
Dustan <Du**********@gmail.com> wrote: BTW, experience tells me it is necessary for me to explicitly state that I'm a newbie (otherwise I get rude people saying I should already know such-and-such).
That experience generalize poorly to comp.lang.python.
Dustan a écrit : I'm trying to get a scrollbar bound with a Frame, and I keep on getting a scrollbar, but it doesn't actually scroll. Some help, please?
Frames are NOT scrollable objects for scrollbars in Tkinter: Listbox,
Canvas and Text widget are.
I f you want/need to scroll something else, I think you are going to
have to do it yourself, meaning you can use the scrollbars to get user
input by binding an event to it, and then moving things around your
Frame to give the scrolling appearance.
OR you can take a look at a third-party such as PythonMegaWidgets (PMW)
who have them I believe...
Happy New Year anyhow...
Jean-Marc
Yes, I know PMW has scrolled Text, but the module has to be installed
seperately; this is something I'm releasing to a number of people.
I'll try doing it with a canvas. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Thomas Buschhardt |
last post by:
Hallo,
I have a problem with Tkinter and the module socket. In a console-window
everything works fine, but in a Tkinter-window I can no more use the
widgets. I found some other mails with this problem, but no solution (I
understand really :-)
Here is my code:
-----------------------------------------------
import win32ui, dde, string,...
|
by: Patrick L. Nolan |
last post by:
Our Tkinter application has a big ScrolledText widget which is
a log of everything that happens. In order to prevent people
from making changes, we have it in DISABLED mode except when
the program wants to write a new entry. This works OK, except
that sometimes we want to copy out of piece of the contents and
paste it in another window. ...
|
by: syed_saqib_ali |
last post by:
Please take a look at and run the code snippet shown below.
It creates a canvas with vertical & Horizontal scroll-bars.
If you shrink the window to smaller than the area of the canvas, the
scroll-bars work as advertised. That's great.
However, if you click the Left Mouse button, it calls code which
expands the width of the canvas by 100...
|
by: syed_saqib_ali |
last post by:
Below is a simple code snippet showing a Tkinter Window bearing a
canvas and 2 connected scrollbars (Vertical & Horizontal). Works fine.
When you shrink/resize the window the scrollbars adjust accordingly.
However, what I really want to happen is that the area of the canvas
that the scrollbars show (the Scrollregion) should expand as the...
|
by: C D Wood |
last post by:
To whom this may concern,
Below is the source code, which
demonstrates a
problem I am having making a GUI for my python project work.
'table.txt'
is a file that is read from the same folder.
My code writes to a text file 'table.txt', and 'table.txt' is displayed
in
| |
by: Michael Yanowitz |
last post by:
Hello:
Below I have included a stripped down version of the GUI I am working on.
It contains 2 dialog boxes - one main and one settings. It has the following
problems, probably all related, that I am hoping someone knows what I am
doing wrong:
1) Pressing the Settings.. Button multiple times, brings up many instances
of the Settings...
|
by: jim-on-linux |
last post by:
py help,
The file below will run as a stand alone file.
It works fine as it is.
But, when I call it from another module it locks
my computer, The off switch is the only
salvation.
This module when run as a stand alone, it will
|
by: Nebulism |
last post by:
Hi everyone,
I am working on a module for my GUI that shows one image with an index value below and would use a scrollbar to control which of the images are displayed. The images are stored in a successive folder in the format Pic#, i,e. Pic1, Pic2 etc.
What I want to do is make a slider that is attached to a label which would output the...
|
by: goldtech |
last post by:
Hi,
I'm stumped on how to have a scrollbar with a long list of checkboxes.
Given code like:
from Tkinter import *
root = Tk()
states =
for i in range(150):
var = IntVar()
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
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. ...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |