[Patches] [ python-Patches-484986 ] Add PanedWindow to Demos/tix

noreply@sourceforge.net noreply@sourceforge.net
Sun, 25 Nov 2001 07:02:45 -0800


Patches item #484986, was opened at 2001-11-23 13:28
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=484986&group_id=5470

Category: Tkinter
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 5
Submitted By: Internet Discovery (idiscovery)
Assigned to: Nobody/Anonymous (nobody)
Summary: Add PanedWindow to Demos/tix

Initial Comment:
Translate another demo to Python - PanedWindow.

Minor changes to Tix.py to add methods to RefHandle,
and work around what may be an incompleteness in Tix.

Bulletproof tixwidgets.py demo program and fix a longstanding
bug in the Scrolled Widgets/ScrolledWindow demo. In all previous
versions the image was not showing up in the scrolled window -
no problem in the Tcl version of Tix. Please look at the way I fixed
this - look for the global variable image1. Perhaps there is a better
way of fixing this problem, or else it points towards a problem with
Tkinter itself.



----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2001-11-25 07:02

Message:
Logged In: YES 
user_id=21627

Thanks, applied as Tix.py 1.6, tixwidgets.py 1.3,
PanedWin.py 1.1, NEWS 1.320.

As for image1: It is not necessary to declare a global
variable global on the global level; just assign to it (I've
left it in the code).

I believe keeping it global is necessary because otherwise,
the reference to the Image Python object is dropped
(_tkinter does not hold a reference), which in turn leads to
an invocation of "image delete" inside Tkinter.Image.__del__.

The same problem does not show up under Tcl since nobody
would even consider deleting the image there, anyway.

It probably would be best if Tk would reference-count
images. That would mean that you could delete the Tcl image
name, while preserving the image object as long as it is
used in another widget.

Since tixwidgets.py wouldn't win a beauty contest, solving
this problem isn't really urgent, IMO. One solution would be
to tie the lifetime of the image object to the one of the
label, e.g. by saying

lbl.image = image1


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=484986&group_id=5470