summaryrefslogtreecommitdiffstats
path: root/Lib/tkinter/tix.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/tkinter/tix.py')
-rw-r--r--Lib/tkinter/tix.py34
1 files changed, 22 insertions, 12 deletions
diff --git a/Lib/tkinter/tix.py b/Lib/tkinter/tix.py
index c1cdfa7..2ed6a77 100644
--- a/Lib/tkinter/tix.py
+++ b/Lib/tkinter/tix.py
@@ -26,8 +26,10 @@
# appreciate the advantages.
#
+import os
+import tkinter
from tkinter import *
-from tkinter import _cnfmerge, _default_root
+from tkinter import _cnfmerge
# WARNING - TkVersion is a limited precision floating point number
if TkVersion < 3.999:
@@ -72,7 +74,6 @@ TCL_ALL_EVENTS = 0
# BEWARE - this is implemented by copying some code from the Widget class
# in Tkinter (to override Widget initialization) and is therefore
# liable to break.
-import tkinter, os
# Could probably add this to Tkinter.Misc
class tixCommand:
@@ -221,7 +222,7 @@ class Tk(tkinter.Tk, tixCommand):
self.tk.eval('package require Tix')
def destroy(self):
- # For safety, remove an delete_window binding before destroy
+ # For safety, remove the delete_window binding before destroy
self.protocol("WM_DELETE_WINDOW", "")
tkinter.Tk.destroy(self)
@@ -476,10 +477,15 @@ class DisplayStyle:
(multiple) Display Items"""
def __init__(self, itemtype, cnf={}, **kw):
- master = _default_root # global from Tkinter
- if not master and 'refwindow' in cnf: master=cnf['refwindow']
- elif not master and 'refwindow' in kw: master= kw['refwindow']
- elif not master: raise RuntimeError("Too early to create display style: no root window")
+ if 'refwindow' in kw:
+ master = kw['refwindow']
+ elif 'refwindow' in cnf:
+ master = cnf['refwindow']
+ else:
+ master = tkinter._default_root
+ if not master:
+ raise RuntimeError("Too early to create display style: "
+ "no root window")
self.tk = master.tk
self.stylename = self.tk.call('tixDisplayStyle', itemtype,
*self._options(cnf,kw) )
@@ -702,7 +708,7 @@ class DirSelectBox(TixWidget):
class ExFileSelectBox(TixWidget):
"""ExFileSelectBox - MS Windows style file select box.
- It provides an convenient method for the user to select files.
+ It provides a convenient method for the user to select files.
Subwidget Class
--------- -----
@@ -760,7 +766,7 @@ class DirSelectDialog(TixWidget):
# Should inherit from a Dialog class
class ExFileSelectDialog(TixWidget):
"""ExFileSelectDialog - MS Windows style file select dialog.
- It provides an convenient method for the user to select files.
+ It provides a convenient method for the user to select files.
Subwidgets Class
---------- -----
@@ -923,7 +929,11 @@ class HList(TixWidget, XView, YView):
return self.tk.call(self._w, 'header', 'cget', col, opt)
def header_exists(self, col):
- return self.tk.call(self._w, 'header', 'exists', col)
+ # A workaround to Tix library bug (issue #25464).
+ # The documented command is "exists", but only erroneous "exist" is
+ # accepted.
+ return self.tk.getboolean(self.tk.call(self._w, 'header', 'exist', col))
+ header_exist = header_exists
def header_delete(self, col):
self.tk.call(self._w, 'header', 'delete', col)
@@ -1052,8 +1062,8 @@ class InputOnly(TixWidget):
class LabelEntry(TixWidget):
"""LabelEntry - Entry field with label. Packages an entry widget
- and a label into one mega widget. It can beused be used to simplify
- the creation of ``entry-form'' type of interface.
+ and a label into one mega widget. It can be used to simplify the creation
+ of ``entry-form'' type of interface.
Subwidgets Class
---------- -----