473,730 Members | 2,054 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Does changing a Tkinter Variable bound to a widget invoke its'command' callback function?

I am writing a simple (maybe a bit conveluded, but I just started
learning Tkinter) program that uses a 'notebook' code snippet from a
python cookbook. It creates a customizable frame and radio button for
each 'tab' and uses .forget to hide the frames that aren't 'current'.
I modified it to use a Scale slider bar instead of radio buttons.

What my program does is create a parent notebook object, and in each
notebook frame, child notebooks are created. All the sliders are
created with:

command=lambda x: self.display(in t(x))

Which displays the contents of the associated notebook frame (via
forget/pack). All of this also works fine, but I wanted it to be a
little more user-friendly by linking all the sliders on the child
notebooks using a control IntVar so that each child notebook can be on
the same page while scrolling through them. The problem is that when
the currently displayed slider is moved, it updates the current child
notebook, but not the notebooks of the hidden frames. Their sliders
are moved when they are next displayed, but the associated frames are
not updated, so there is a mismatch between slider and frame until
that specific slider is moved.

I can't find much information on control variables with respect to
Scale widgets, so any insight, hints, or suggestions would be greatly
appreciated.

Some snippets of the involved routines:

def __init__(self, master, size, start=0, side=LEFT, choice=None):

self.active_fr = start
self.size = size
if(choice):
self.choice = choice
else:
self.choice = IntVar(value=st art)

....

# create slider
self.slide = Scale(self.rb_f r, variable=self.c hoice,
orient=self.ori ent,
from_=start, to=(size-start+1), length=200,
command=lambda x: self.display(in t(x)))
....

def display(self, fr):
self.frames[self.active_fr].forget()
self.frames[fr].pack(fill=BOTH , expand=1)
self.active_fr = fr
Nov 29 '07 #1
0 1115

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

Similar topics

2
3428
by: John Pote | last post by:
Running my programme in Python 2.3.4 I received the following msg in the consol :- (Pent III running W2K prof) """ Exception in Tkinter callback Traceback (most recent call last): File "c:\apps\python\234\lib\lib-tk\Tkinter.py", line 1345, in __call__ return self.func(*args) File "c:\apps\python\234\lib\lib-tk\Tkinter.py", line 459, in callit
2
1491
by: IKdev | last post by:
What are my options to invoke function (method) in this case: myclass{ private DataSet _userData; //Property in the class: public DataSet UserData (string dsource){ get {return _userData;} set { _userData=??
2
1660
by: Sean | last post by:
Hi all, I know that some variables are stored on heaps and some on stack in C++. How about functions? where does function reside on memory? Is it stack or heap? And are both function (not class member) and method (function in a class) stored in the same location (either stack or heap)?
0
954
by: fb | last post by:
Hi, I have a page with left frame and right frame. From left frame page, I manage to code a script to invoke Button1_Click which resides in a right frame page, provided the Button_Click function is coded in the <head> section of html. When I move the Button_Click function to rightFrame.aspx.vb, the following error encountered when I run the page. I coded Button_Click function in html page as "private" as well. I changed the Private...
4
2475
by: arvind | last post by:
How to pass the variables defined inside the function to the another function on click event of the button in Tkinter? pleas send me a sample code if anybody has it. thanx
5
2323
by: archana | last post by:
Hi all, I am having one confusion regarding invoking method through threading. I have delcared one delegate. and i have one class which has parameter of type delegate which i declared. I have passed address of function which needs to be invoked when my thread procedure complete.
1
1260
by: Horace Nunley | last post by:
I'm expecting this function to return the same value each time the page is hit within the same session: In other words i want to save the guid as a session variable Function TempImageGUID() As String Dim _Temp As String If Not (Session("TempGUID") Is Nothing) Then
4
2945
by: Curious | last post by:
Hi, I have a timer object that's launched as below: mTimer = new System.Threading.Timer (new TimerCallBack(SubscribeTrade), null, 15000, 15000); void SubscribeTrade (object state) { DateTime now = DateTime.Now;
6
2075
by: Max | last post by:
i have a event bind function like this(though it is not so robust): bind$=function(o,evt,fn,cb){ var aE='attachEvent'; var aEL='addEventListener'; if(!o&&o){ return o(evt,fn,!!cb); } return o('on'+evt,fn); };
0
8770
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9299
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9227
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9174
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
6029
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4541
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
4800
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3251
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
2174
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.