Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 731a986

Browse files
committed
Upgrade to Tix-8.1.4 from Mike Clarkson (the maintainer)
1 parent bca1cbc commit 731a986

2 files changed

Lines changed: 23 additions & 9 deletions

File tree

Demo/tix/tixwidgets.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
22
#
3-
# Id: tixwidgets.py,v 1.7 2002/11/14 02:44:08 nnorwitz Exp
43
# $Id$
54
#
65
# tixwidgets.py --
@@ -545,11 +544,7 @@ def MkSWindow(w):
545544

546545
win = Tix.ScrolledWindow(top, scrollbar='auto')
547546

548-
global image1
549-
# This image is not showing up in the Label unless it is set to a
550-
# global variable - no problem under Tcl/Tix. It is being
551-
# garbage collected at the end of this proecedure if not global
552-
image1 = Tix.Image('photo', file=file)
547+
image1 = win.window.image_create('photo', file=file)
553548
lbl = Tix.Label(win.window, image=image1)
554549
lbl.pack(expand=1, fill=Tix.BOTH)
555550

Lib/lib-tk/Tix.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,6 @@ def slaves(self):
256256

257257

258258

259-
260259
Tkinter.Widget.__bases__ = Tkinter.Widget.__bases__ + (Form,)
261260

262261
class TixWidget(Tkinter.Widget):
@@ -377,6 +376,26 @@ def config_all(self, option, value):
377376
names = self._subwidget_names()
378377
for name in names:
379378
self.tk.call(name, 'configure', '-' + option, value)
379+
# These are missing from Tkinter
380+
def image_create(self, imgtype, cnf={}, master=None, **kw):
381+
if not master:
382+
master = Tkinter._default_root
383+
if not master:
384+
raise RuntimeError, 'Too early to create image'
385+
if kw and cnf: cnf = _cnfmerge((cnf, kw))
386+
elif kw: cnf = kw
387+
options = ()
388+
for k, v in cnf.items():
389+
if callable(v):
390+
v = self._register(v)
391+
options = options + ('-'+k, v)
392+
return master.tk.call(('image', 'create', imgtype,) + options)
393+
def image_delete(self, imgname):
394+
try:
395+
self.tk.call('image', 'delete', imgname)
396+
except TclError:
397+
# May happen if the root was destroyed
398+
pass
380399

381400
# Subwidgets are child widgets created automatically by mega-widgets.
382401
# In python, we have to create these subwidgets manually to mirror their
@@ -565,6 +584,8 @@ def __init__ (self, master=None, cnf={}, **kw):
565584
# unavailable when -fancy not specified
566585
pass
567586

587+
# align
588+
568589
def add_history(self, str):
569590
self.tk.call(self._w, 'addhistory', str)
570591

@@ -1247,8 +1268,6 @@ def post_widget(self, widget, x, y):
12471268

12481269
class ResizeHandle(TixWidget):
12491270
"""Internal widget to draw resize handles on Scrolled widgets."""
1250-
# FIXME: This is dangerous to expose to be called on its own.
1251-
# Perhaps rename ResizeHandle to _ResizeHandle
12521271
def __init__(self, master, cnf={}, **kw):
12531272
# There seems to be a Tix bug rejecting the configure method
12541273
# Let's try making the flags -static

0 commit comments

Comments
 (0)