Re: tkinter questions: behavior of StringVar, etc



On 3/29/2009 7:29 AM Francesco Bochicchio apparently wrote:
1. Tkinter is only a thin wrapper over Tk, a GUI library initially developed for Tcl language, so many of the answer to the design choices you question (e.g. what is the master) cannot between answered within the python documentation but should be searched in the Tcl/Tk documentation. So google for tcl/tk. Anyway, all GUI libraries I know of build the GUI as a hierarchical structure. The master (often called root) ia the root of this hierarchy, and you have to build it before building the rest.

I understand this. But I do not understand what we get
by having each Variable instance register a master.
(In contrast, e.g., to a container widget, such as a Frame,
where I do not have this question.)


2. Another good source of information is the source of Tkinter itself, which is mostly in the Tkinter.py file.

In Python 3, I'm finding most of the useful stuff to be in
``tkinter/__init__.py``. It is indeed useful, but not
always transparent. At least to a new user.


if you for instance look at the __init__ method of the Variable class (which is the basic class of StringVar), you will easily find the 'magic' to which you refer to.

What we find is that Variable is initialized with:
if not master:
master = _default_root
which in turn is initialized to None. I understand this.
Actually, talking this through, I get it now. I was not
properly thinking about the use of module level globals.
Thanks.


If you don't like the choices which have been made there (e.g not automagically creatinga a master for variables but doing it for frames ), you could try and submit a patch :-)

I am not so presumptuous. I just want to understand why a
Variable needs a master. How is this used?

And, I would like to understand if there is a *reason* that
a StringVar instance, for example, does not behave more like
a string.


3. Usually the changes between one version of python and the next are documented (but not in all gory details) in "What is new" documents you can find in python.org site. I'm not aware of any change for Tkinter, in Python 3.0 but go read it yourself.

I did look there, and explicitly got only that the new name
is ``tkinter``. However, there are other changes, e.g. the
names and location of ``colorchooser`` and ``filedialog``.
I realize now that the statement "related modules have been
grouped into packages, and usually the submodule names have
been simplified" is supposed to capture all this, but an
explicit list would have been helpful to me. (And,
I assume, to others.) I also just assumed that some active
user had made a list of changes, which I had overlooked, but
that someone on this list would be aware of.

Thanks,
Alan Isaac
.



Relevant Pages

  • Re: Master pages, how to make them work?
    ... I still don't see how a Master page can dynamically using different content ... ContentPlaceHolders to set and/or obtain values in the reference pages? ... in each table cell has ContentPlaceHolder (IDs, cph_Header, ... very frustrated with complete lack of useful documentation that doesn't ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Master pages, how to make them work?
    ... how do you control the flow of each content controls and their contents? ... You have absolutely defeated the purpose of the master page. ... So what page do I reference if I'm testing from a Browser?? ... very frustrated with complete lack of useful documentation that doesn't ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Master pages, how to make them work?
    ... A sample Master Page ... frustrated with complete lack of useful documentation that doesn't require ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Wrestle with this code :) !
    ... > Richard H wrote: ... I am looking for tools and methods to master a software written ... > give you rudimentary documentation that may be able to get you started. ... But people should realize that ESSModel is a great free tool out there, ...
    (borland.public.delphi.non-technical)
  • RE: tkinter questions: behavior of StringVar, etc
    ... Scott David Daniels said: ... ss = StringVar() ... If you do not specify a master object in the StringVarstatement, ... widgetclass(master, option=value, ...) -> widget ...
    (comp.lang.python)