Title: Variable.__init__ uses self.set(), blocking specialization
Type: enhancement Stage: test needed
Components: Tkinter Versions: Python 3.3
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: gpolo Nosy List: ajaksu2, asvetlov, droun, gpolo, loewis, python-dev
Priority: normal Keywords: patch

Created on 2005-04-07 21:01 by droun, last changed 2012-03-13 16:44 by loewis. This issue is now closed.

File name Uploaded Description Edit
tk.patch asvetlov, 2012-03-12 23:53 review
Messages (4)
msg60719 - (view) Author: Emil (droun) Date: 2005-04-07 21:01
in class Variable the constructor uses self.set() to set 
the value of the variable. This makes it hard and in some 
cases impossible to make a speciallization of Variable 
that performs some operation after changing the value. It 
would be preferable to use Tkinter.Variable.set(self, 


class ViewChanger(Tkinter.StringVar) :

    def __init__(self, views) :
        self.views = views

    def set(self, newview) :

get() and everything else will use the normal StringVar 
ipementation, but when the value is changed, a new view 
is activated.
At creation here the self.views varaible will be accessed, 
method activate() will be called, and it might not even be 
fully initiallized yet. This is the normal case if you want 
to supply a variable to a widget, where a variable change 
may update the widget. 
msg82174 - (view) Author: Daniel Diniz (ajaksu2) Date: 2009-02-15 22:16
Code is still as described in trunk rev69546.
msg155545 - (view) Author: Roundup Robot (python-dev) Date: 2012-03-13 00:47
New changeset 79bb99ec2464 by Martin v. Löwis in branch 'default':
Issue #1178863: Separate initialisation from setting when initializing
msg155633 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-03-13 16:44
Thanks for the patch.
Date User Action Args
2012-03-13 16:44:59loewissetstatus: open -> closed
resolution: fixed
messages: + msg155633
2012-03-13 00:47:47python-devsetnosy: + python-dev
messages: + msg155545
2012-03-12 23:54:04asvetlovsetnosy: + asvetlov
2012-03-12 23:53:44asvetlovsetfiles: + tk.patch
keywords: + patch
versions: + Python 3.3, - Python 3.2
2010-08-21 13:41:19BreamoreBoysetassignee: loewis -> gpolo

nosy: + gpolo
versions: + Python 3.2, - Python 2.7
2009-02-15 22:16:03ajaksu2setnosy: + ajaksu2
stage: test needed
type: enhancement
messages: + msg82174
versions: + Python 2.7, - Python 2.4
2005-04-07 21:01:52drouncreate