Merged revisions 74446-74449 via svnmerge from
svn+ssh://pythondev/python/trunk ........ r74446 | guilherme.polo | 2009-08-14 10:53:41 -0300 (Fri, 14 Aug 2009) | 1 line Issue #3344: Replace itertools.count by enumerate. ........ r74447 | guilherme.polo | 2009-08-14 11:03:07 -0300 (Fri, 14 Aug 2009) | 1 line Issue #3926: Fix the usage of the new showwarnings and formatwarning. ........ r74448 | guilherme.polo | 2009-08-14 11:36:45 -0300 (Fri, 14 Aug 2009) | 3 lines Issue #1135: Add the XView and YView mix-ins to avoid duplicating the xview* and yview* methods. ........ r74449 | guilherme.polo | 2009-08-14 11:43:43 -0300 (Fri, 14 Aug 2009) | 1 line Clarifying Entry.selection_present's docstring. ........
This commit is contained in:
parent
6837083582
commit
1fff008326
|
@ -3,7 +3,6 @@ import os
|
||||||
import re
|
import re
|
||||||
import string
|
import string
|
||||||
import imp
|
import imp
|
||||||
from itertools import count
|
|
||||||
from tkinter import *
|
from tkinter import *
|
||||||
import tkinter.simpledialog as tkSimpleDialog
|
import tkinter.simpledialog as tkSimpleDialog
|
||||||
import tkinter.messagebox as tkMessageBox
|
import tkinter.messagebox as tkMessageBox
|
||||||
|
@ -785,8 +784,8 @@ class EditorWindow(object):
|
||||||
for instance in self.top.instance_dict:
|
for instance in self.top.instance_dict:
|
||||||
menu = instance.recent_files_menu
|
menu = instance.recent_files_menu
|
||||||
menu.delete(1, END) # clear, and rebuild:
|
menu.delete(1, END) # clear, and rebuild:
|
||||||
for i, file in zip(count(), rf_list):
|
for i, file_name in enumerate(rf_list):
|
||||||
file_name = file[0:-1] # zap \n
|
file_name = file_name.rstrip() # zap \n
|
||||||
# make unicode string to display non-ASCII chars correctly
|
# make unicode string to display non-ASCII chars correctly
|
||||||
ufile_name = self._filename_to_unicode(file_name)
|
ufile_name = self._filename_to_unicode(file_name)
|
||||||
callback = instance.__recent_file_callback(file_name)
|
callback = instance.__recent_file_callback(file_name)
|
||||||
|
|
|
@ -55,20 +55,21 @@ except ImportError:
|
||||||
else:
|
else:
|
||||||
def idle_showwarning(message, category, filename, lineno,
|
def idle_showwarning(message, category, filename, lineno,
|
||||||
file=None, line=None):
|
file=None, line=None):
|
||||||
file = warning_stream
|
if file is None:
|
||||||
|
file = warning_stream
|
||||||
try:
|
try:
|
||||||
file.write(warnings.formatwarning(message, category, filename,\
|
file.write(warnings.formatwarning(message, category, filename,
|
||||||
lineno, file=file, line=line))
|
lineno, file=file, line=line))
|
||||||
except IOError:
|
except IOError:
|
||||||
pass ## file (probably __stderr__) is invalid, warning dropped.
|
pass ## file (probably __stderr__) is invalid, warning dropped.
|
||||||
warnings.showwarning = idle_showwarning
|
warnings.showwarning = idle_showwarning
|
||||||
def idle_formatwarning(message, category, filename, lineno,
|
def idle_formatwarning(message, category, filename, lineno, line=None):
|
||||||
file=None, line=None):
|
|
||||||
"""Format warnings the IDLE way"""
|
"""Format warnings the IDLE way"""
|
||||||
s = "\nWarning (from warnings module):\n"
|
s = "\nWarning (from warnings module):\n"
|
||||||
s += ' File \"%s\", line %s\n' % (filename, lineno)
|
s += ' File \"%s\", line %s\n' % (filename, lineno)
|
||||||
line = linecache.getline(filename, lineno).strip() \
|
if line is None:
|
||||||
if line is None else line
|
line = linecache.getline(filename, lineno)
|
||||||
|
line = line.strip()
|
||||||
if line:
|
if line:
|
||||||
s += " %s\n" % line
|
s += " %s\n" % line
|
||||||
s += "%s: %s\n>>> " % (category.__name__, message)
|
s += "%s: %s\n>>> " % (category.__name__, message)
|
||||||
|
@ -81,18 +82,17 @@ def extended_linecache_checkcache(filename=None,
|
||||||
|
|
||||||
Rather than repeating the linecache code, patch it to save the
|
Rather than repeating the linecache code, patch it to save the
|
||||||
<pyshell#...> entries, call the original linecache.checkcache()
|
<pyshell#...> entries, call the original linecache.checkcache()
|
||||||
(which destroys them), and then restore the saved entries.
|
(skipping them), and then restore the saved entries.
|
||||||
|
|
||||||
orig_checkcache is bound at definition time to the original
|
orig_checkcache is bound at definition time to the original
|
||||||
method, allowing it to be patched.
|
method, allowing it to be patched.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
cache = linecache.cache
|
cache = linecache.cache
|
||||||
save = {}
|
save = {}
|
||||||
for filename in cache:
|
for key in list(cache):
|
||||||
if filename[:1] + filename[-1:] == '<>':
|
if key[:1] + key[-1:] == '<>':
|
||||||
save[filename] = cache[filename]
|
save[key] = cache.pop(key)
|
||||||
orig_checkcache()
|
orig_checkcache(filename)
|
||||||
cache.update(save)
|
cache.update(save)
|
||||||
|
|
||||||
# Patch linecache.checkcache():
|
# Patch linecache.checkcache():
|
||||||
|
|
|
@ -25,12 +25,13 @@ except ImportError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
def idle_formatwarning_subproc(message, category, filename, lineno,
|
def idle_formatwarning_subproc(message, category, filename, lineno,
|
||||||
file=None, line=None):
|
line=None):
|
||||||
"""Format warnings the IDLE way"""
|
"""Format warnings the IDLE way"""
|
||||||
s = "\nWarning (from warnings module):\n"
|
s = "\nWarning (from warnings module):\n"
|
||||||
s += ' File \"%s\", line %s\n' % (filename, lineno)
|
s += ' File \"%s\", line %s\n' % (filename, lineno)
|
||||||
line = linecache.getline(filename, lineno).strip() \
|
if line is None:
|
||||||
if line is None else line
|
line = linecache.getline(filename, lineno)
|
||||||
|
line = line.strip()
|
||||||
if line:
|
if line:
|
||||||
s += " %s\n" % line
|
s += " %s\n" % line
|
||||||
s += "%s: %s\n" % (category.__name__, message)
|
s += "%s: %s\n" % (category.__name__, message)
|
||||||
|
|
|
@ -1403,6 +1403,48 @@ class CallWrapper:
|
||||||
self.widget._report_exception()
|
self.widget._report_exception()
|
||||||
|
|
||||||
|
|
||||||
|
class XView:
|
||||||
|
"""Mix-in class for querying and changing the horizontal position
|
||||||
|
of a widget's window."""
|
||||||
|
|
||||||
|
def xview(self, *args):
|
||||||
|
"""Query and change the horizontal position of the view."""
|
||||||
|
res = self.tk.call(self._w, 'xview', *args)
|
||||||
|
if not args:
|
||||||
|
return self._getdoubles(res)
|
||||||
|
|
||||||
|
def xview_moveto(self, fraction):
|
||||||
|
"""Adjusts the view in the window so that FRACTION of the
|
||||||
|
total width of the canvas is off-screen to the left."""
|
||||||
|
self.tk.call(self._w, 'xview', 'moveto', fraction)
|
||||||
|
|
||||||
|
def xview_scroll(self, number, what):
|
||||||
|
"""Shift the x-view according to NUMBER which is measured in "units"
|
||||||
|
or "pages" (WHAT)."""
|
||||||
|
self.tk.call(self._w, 'xview', 'scroll', number, what)
|
||||||
|
|
||||||
|
|
||||||
|
class YView:
|
||||||
|
"""Mix-in class for querying and changing the vertical position
|
||||||
|
of a widget's window."""
|
||||||
|
|
||||||
|
def yview(self, *args):
|
||||||
|
"""Query and change the vertical position of the view."""
|
||||||
|
res = self.tk.call(self._w, 'yview', *args)
|
||||||
|
if not args:
|
||||||
|
return self._getdoubles(res)
|
||||||
|
|
||||||
|
def yview_moveto(self, fraction):
|
||||||
|
"""Adjusts the view in the window so that FRACTION of the
|
||||||
|
total height of the canvas is off-screen to the top."""
|
||||||
|
self.tk.call(self._w, 'yview', 'moveto', fraction)
|
||||||
|
|
||||||
|
def yview_scroll(self, number, what):
|
||||||
|
"""Shift the y-view according to NUMBER which is measured in
|
||||||
|
"units" or "pages" (WHAT)."""
|
||||||
|
self.tk.call(self._w, 'yview', 'scroll', number, what)
|
||||||
|
|
||||||
|
|
||||||
class Wm:
|
class Wm:
|
||||||
"""Provides functions for the communication with the window manager."""
|
"""Provides functions for the communication with the window manager."""
|
||||||
|
|
||||||
|
@ -2041,7 +2083,7 @@ def At(x, y=None):
|
||||||
else:
|
else:
|
||||||
return '@%r,%r' % (x, y)
|
return '@%r,%r' % (x, y)
|
||||||
|
|
||||||
class Canvas(Widget):
|
class Canvas(Widget, XView, YView):
|
||||||
"""Canvas widget to display graphical elements like lines or text."""
|
"""Canvas widget to display graphical elements like lines or text."""
|
||||||
def __init__(self, master=None, cnf={}, **kw):
|
def __init__(self, master=None, cnf={}, **kw):
|
||||||
"""Construct a canvas widget with the parent MASTER.
|
"""Construct a canvas widget with the parent MASTER.
|
||||||
|
@ -2281,30 +2323,6 @@ class Canvas(Widget):
|
||||||
def type(self, tagOrId):
|
def type(self, tagOrId):
|
||||||
"""Return the type of the item TAGORID."""
|
"""Return the type of the item TAGORID."""
|
||||||
return self.tk.call(self._w, 'type', tagOrId) or None
|
return self.tk.call(self._w, 'type', tagOrId) or None
|
||||||
def xview(self, *args):
|
|
||||||
"""Query and change horizontal position of the view."""
|
|
||||||
if not args:
|
|
||||||
return self._getdoubles(self.tk.call(self._w, 'xview'))
|
|
||||||
self.tk.call((self._w, 'xview') + args)
|
|
||||||
def xview_moveto(self, fraction):
|
|
||||||
"""Adjusts the view in the window so that FRACTION of the
|
|
||||||
total width of the canvas is off-screen to the left."""
|
|
||||||
self.tk.call(self._w, 'xview', 'moveto', fraction)
|
|
||||||
def xview_scroll(self, number, what):
|
|
||||||
"""Shift the x-view according to NUMBER which is measured in "units" or "pages" (WHAT)."""
|
|
||||||
self.tk.call(self._w, 'xview', 'scroll', number, what)
|
|
||||||
def yview(self, *args):
|
|
||||||
"""Query and change vertical position of the view."""
|
|
||||||
if not args:
|
|
||||||
return self._getdoubles(self.tk.call(self._w, 'yview'))
|
|
||||||
self.tk.call((self._w, 'yview') + args)
|
|
||||||
def yview_moveto(self, fraction):
|
|
||||||
"""Adjusts the view in the window so that FRACTION of the
|
|
||||||
total height of the canvas is off-screen to the top."""
|
|
||||||
self.tk.call(self._w, 'yview', 'moveto', fraction)
|
|
||||||
def yview_scroll(self, number, what):
|
|
||||||
"""Shift the y-view according to NUMBER which is measured in "units" or "pages" (WHAT)."""
|
|
||||||
self.tk.call(self._w, 'yview', 'scroll', number, what)
|
|
||||||
|
|
||||||
class Checkbutton(Widget):
|
class Checkbutton(Widget):
|
||||||
"""Checkbutton widget which is either in on- or off-state."""
|
"""Checkbutton widget which is either in on- or off-state."""
|
||||||
|
@ -2335,7 +2353,7 @@ class Checkbutton(Widget):
|
||||||
"""Toggle the button."""
|
"""Toggle the button."""
|
||||||
self.tk.call(self._w, 'toggle')
|
self.tk.call(self._w, 'toggle')
|
||||||
|
|
||||||
class Entry(Widget):
|
class Entry(Widget, XView):
|
||||||
"""Entry widget which allows to display simple text."""
|
"""Entry widget which allows to display simple text."""
|
||||||
def __init__(self, master=None, cnf={}, **kw):
|
def __init__(self, master=None, cnf={}, **kw):
|
||||||
"""Construct an entry widget with the parent MASTER.
|
"""Construct an entry widget with the parent MASTER.
|
||||||
|
@ -2386,7 +2404,8 @@ class Entry(Widget):
|
||||||
self.tk.call(self._w, 'selection', 'from', index)
|
self.tk.call(self._w, 'selection', 'from', index)
|
||||||
select_from = selection_from
|
select_from = selection_from
|
||||||
def selection_present(self):
|
def selection_present(self):
|
||||||
"""Return whether the widget has the selection."""
|
"""Return True if there are characters selected in the entry, False
|
||||||
|
otherwise."""
|
||||||
return self.tk.getboolean(
|
return self.tk.getboolean(
|
||||||
self.tk.call(self._w, 'selection', 'present'))
|
self.tk.call(self._w, 'selection', 'present'))
|
||||||
select_present = selection_present
|
select_present = selection_present
|
||||||
|
@ -2398,16 +2417,6 @@ class Entry(Widget):
|
||||||
"""Set the variable end of a selection to INDEX."""
|
"""Set the variable end of a selection to INDEX."""
|
||||||
self.tk.call(self._w, 'selection', 'to', index)
|
self.tk.call(self._w, 'selection', 'to', index)
|
||||||
select_to = selection_to
|
select_to = selection_to
|
||||||
def xview(self, index):
|
|
||||||
"""Query and change horizontal position of the view."""
|
|
||||||
self.tk.call(self._w, 'xview', index)
|
|
||||||
def xview_moveto(self, fraction):
|
|
||||||
"""Adjust the view in the window so that FRACTION of the
|
|
||||||
total width of the entry is off-screen to the left."""
|
|
||||||
self.tk.call(self._w, 'xview', 'moveto', fraction)
|
|
||||||
def xview_scroll(self, number, what):
|
|
||||||
"""Shift the x-view according to NUMBER which is measured in "units" or "pages" (WHAT)."""
|
|
||||||
self.tk.call(self._w, 'xview', 'scroll', number, what)
|
|
||||||
|
|
||||||
class Frame(Widget):
|
class Frame(Widget):
|
||||||
"""Frame widget which may contain other widgets and can have a 3D border."""
|
"""Frame widget which may contain other widgets and can have a 3D border."""
|
||||||
|
@ -2449,7 +2458,7 @@ class Label(Widget):
|
||||||
"""
|
"""
|
||||||
Widget.__init__(self, master, 'label', cnf, kw)
|
Widget.__init__(self, master, 'label', cnf, kw)
|
||||||
|
|
||||||
class Listbox(Widget):
|
class Listbox(Widget, XView, YView):
|
||||||
"""Listbox widget which can display a list of strings."""
|
"""Listbox widget which can display a list of strings."""
|
||||||
def __init__(self, master=None, cnf={}, **kw):
|
def __init__(self, master=None, cnf={}, **kw):
|
||||||
"""Construct a listbox widget with the parent MASTER.
|
"""Construct a listbox widget with the parent MASTER.
|
||||||
|
@ -2528,30 +2537,6 @@ class Listbox(Widget):
|
||||||
def size(self):
|
def size(self):
|
||||||
"""Return the number of elements in the listbox."""
|
"""Return the number of elements in the listbox."""
|
||||||
return getint(self.tk.call(self._w, 'size'))
|
return getint(self.tk.call(self._w, 'size'))
|
||||||
def xview(self, *what):
|
|
||||||
"""Query and change horizontal position of the view."""
|
|
||||||
if not what:
|
|
||||||
return self._getdoubles(self.tk.call(self._w, 'xview'))
|
|
||||||
self.tk.call((self._w, 'xview') + what)
|
|
||||||
def xview_moveto(self, fraction):
|
|
||||||
"""Adjust the view in the window so that FRACTION of the
|
|
||||||
total width of the entry is off-screen to the left."""
|
|
||||||
self.tk.call(self._w, 'xview', 'moveto', fraction)
|
|
||||||
def xview_scroll(self, number, what):
|
|
||||||
"""Shift the x-view according to NUMBER which is measured in "units" or "pages" (WHAT)."""
|
|
||||||
self.tk.call(self._w, 'xview', 'scroll', number, what)
|
|
||||||
def yview(self, *what):
|
|
||||||
"""Query and change vertical position of the view."""
|
|
||||||
if not what:
|
|
||||||
return self._getdoubles(self.tk.call(self._w, 'yview'))
|
|
||||||
self.tk.call((self._w, 'yview') + what)
|
|
||||||
def yview_moveto(self, fraction):
|
|
||||||
"""Adjust the view in the window so that FRACTION of the
|
|
||||||
total width of the entry is off-screen to the top."""
|
|
||||||
self.tk.call(self._w, 'yview', 'moveto', fraction)
|
|
||||||
def yview_scroll(self, number, what):
|
|
||||||
"""Shift the y-view according to NUMBER which is measured in "units" or "pages" (WHAT)."""
|
|
||||||
self.tk.call(self._w, 'yview', 'scroll', number, what)
|
|
||||||
def itemcget(self, index, option):
|
def itemcget(self, index, option):
|
||||||
"""Return the resource value for an ITEM and an OPTION."""
|
"""Return the resource value for an ITEM and an OPTION."""
|
||||||
return self.tk.call(
|
return self.tk.call(
|
||||||
|
@ -2798,7 +2783,7 @@ class Scrollbar(Widget):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Text(Widget):
|
class Text(Widget, XView, YView):
|
||||||
"""Text widget which can display text in various forms."""
|
"""Text widget which can display text in various forms."""
|
||||||
def __init__(self, master=None, cnf={}, **kw):
|
def __init__(self, master=None, cnf={}, **kw):
|
||||||
"""Construct a text widget with the parent MASTER.
|
"""Construct a text widget with the parent MASTER.
|
||||||
|
@ -3120,32 +3105,6 @@ class Text(Widget):
|
||||||
"""Return all names of embedded windows in this widget."""
|
"""Return all names of embedded windows in this widget."""
|
||||||
return self.tk.splitlist(
|
return self.tk.splitlist(
|
||||||
self.tk.call(self._w, 'window', 'names'))
|
self.tk.call(self._w, 'window', 'names'))
|
||||||
def xview(self, *what):
|
|
||||||
"""Query and change horizontal position of the view."""
|
|
||||||
if not what:
|
|
||||||
return self._getdoubles(self.tk.call(self._w, 'xview'))
|
|
||||||
self.tk.call((self._w, 'xview') + what)
|
|
||||||
def xview_moveto(self, fraction):
|
|
||||||
"""Adjusts the view in the window so that FRACTION of the
|
|
||||||
total width of the canvas is off-screen to the left."""
|
|
||||||
self.tk.call(self._w, 'xview', 'moveto', fraction)
|
|
||||||
def xview_scroll(self, number, what):
|
|
||||||
"""Shift the x-view according to NUMBER which is measured
|
|
||||||
in "units" or "pages" (WHAT)."""
|
|
||||||
self.tk.call(self._w, 'xview', 'scroll', number, what)
|
|
||||||
def yview(self, *what):
|
|
||||||
"""Query and change vertical position of the view."""
|
|
||||||
if not what:
|
|
||||||
return self._getdoubles(self.tk.call(self._w, 'yview'))
|
|
||||||
self.tk.call((self._w, 'yview') + what)
|
|
||||||
def yview_moveto(self, fraction):
|
|
||||||
"""Adjusts the view in the window so that FRACTION of the
|
|
||||||
total height of the canvas is off-screen to the top."""
|
|
||||||
self.tk.call(self._w, 'yview', 'moveto', fraction)
|
|
||||||
def yview_scroll(self, number, what):
|
|
||||||
"""Shift the y-view according to NUMBER which is measured
|
|
||||||
in "units" or "pages" (WHAT)."""
|
|
||||||
self.tk.call(self._w, 'yview', 'scroll', number, what)
|
|
||||||
def yview_pickplace(self, *what):
|
def yview_pickplace(self, *what):
|
||||||
"""Obsolete function, use see."""
|
"""Obsolete function, use see."""
|
||||||
self.tk.call((self._w, 'yview', '-pickplace') + what)
|
self.tk.call((self._w, 'yview', '-pickplace') + what)
|
||||||
|
@ -3331,7 +3290,7 @@ def image_names(): return _default_root.tk.call('image', 'names')
|
||||||
def image_types(): return _default_root.tk.call('image', 'types')
|
def image_types(): return _default_root.tk.call('image', 'types')
|
||||||
|
|
||||||
|
|
||||||
class Spinbox(Widget):
|
class Spinbox(Widget, XView):
|
||||||
"""spinbox widget."""
|
"""spinbox widget."""
|
||||||
def __init__(self, master=None, cnf={}, **kw):
|
def __init__(self, master=None, cnf={}, **kw):
|
||||||
"""Construct a spinbox widget with the parent MASTER.
|
"""Construct a spinbox widget with the parent MASTER.
|
||||||
|
|
|
@ -850,7 +850,7 @@ class FileEntry(TixWidget):
|
||||||
# FIXME: return python object
|
# FIXME: return python object
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class HList(TixWidget):
|
class HList(TixWidget, XView, YView):
|
||||||
"""HList - Hierarchy display widget can be used to display any data
|
"""HList - Hierarchy display widget can be used to display any data
|
||||||
that have a hierarchical structure, for example, file system directory
|
that have a hierarchical structure, for example, file system directory
|
||||||
trees. The list entries are indented and connected by branch lines
|
trees. The list entries are indented and connected by branch lines
|
||||||
|
@ -1037,12 +1037,6 @@ class HList(TixWidget):
|
||||||
def show_entry(self, entry):
|
def show_entry(self, entry):
|
||||||
return self.tk.call(self._w, 'show', 'entry', entry)
|
return self.tk.call(self._w, 'show', 'entry', entry)
|
||||||
|
|
||||||
def xview(self, *args):
|
|
||||||
self.tk.call(self._w, 'xview', *args)
|
|
||||||
|
|
||||||
def yview(self, *args):
|
|
||||||
self.tk.call(self._w, 'yview', *args)
|
|
||||||
|
|
||||||
class InputOnly(TixWidget):
|
class InputOnly(TixWidget):
|
||||||
"""InputOnly - Invisible widget. Unix only.
|
"""InputOnly - Invisible widget. Unix only.
|
||||||
|
|
||||||
|
@ -1419,7 +1413,7 @@ class StdButtonBox(TixWidget):
|
||||||
if name in self.subwidget_list:
|
if name in self.subwidget_list:
|
||||||
self.tk.call(self._w, 'invoke', name)
|
self.tk.call(self._w, 'invoke', name)
|
||||||
|
|
||||||
class TList(TixWidget):
|
class TList(TixWidget, XView, YView):
|
||||||
"""TList - Hierarchy display widget which can be
|
"""TList - Hierarchy display widget which can be
|
||||||
used to display data in a tabular format. The list entries of a TList
|
used to display data in a tabular format. The list entries of a TList
|
||||||
widget are similar to the entries in the Tk listbox widget. The main
|
widget are similar to the entries in the Tk listbox widget. The main
|
||||||
|
@ -1502,12 +1496,6 @@ class TList(TixWidget):
|
||||||
def selection_set(self, first, last=None):
|
def selection_set(self, first, last=None):
|
||||||
self.tk.call(self._w, 'selection', 'set', first, last)
|
self.tk.call(self._w, 'selection', 'set', first, last)
|
||||||
|
|
||||||
def xview(self, *args):
|
|
||||||
self.tk.call(self._w, 'xview', *args)
|
|
||||||
|
|
||||||
def yview(self, *args):
|
|
||||||
self.tk.call(self._w, 'yview', *args)
|
|
||||||
|
|
||||||
class Tree(TixWidget):
|
class Tree(TixWidget):
|
||||||
"""Tree - The tixTree widget can be used to display hierachical
|
"""Tree - The tixTree widget can be used to display hierachical
|
||||||
data in a tree form. The user can adjust
|
data in a tree form. The user can adjust
|
||||||
|
@ -1777,7 +1765,7 @@ class CObjView(TixWidget):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Grid(TixWidget):
|
class Grid(TixWidget, XView, YView):
|
||||||
'''The Tix Grid command creates a new window and makes it into a
|
'''The Tix Grid command creates a new window and makes it into a
|
||||||
tixGrid widget. Additional options, may be specified on the command
|
tixGrid widget. Additional options, may be specified on the command
|
||||||
line or in the option database to configure aspects such as its cursor
|
line or in the option database to configure aspects such as its cursor
|
||||||
|
@ -1865,22 +1853,6 @@ class Grid(TixWidget):
|
||||||
# def size dim index ?option value ...?
|
# def size dim index ?option value ...?
|
||||||
# def unset x y
|
# def unset x y
|
||||||
|
|
||||||
def xview(self):
|
|
||||||
return self._getdoubles(self.tk.call(self, 'xview'))
|
|
||||||
def xview_moveto(self, fraction):
|
|
||||||
self.tk.call(self,'xview', 'moveto', fraction)
|
|
||||||
def xview_scroll(self, count, what="units"):
|
|
||||||
"Scroll right (count>0) or left <count> of units|pages"
|
|
||||||
self.tk.call(self, 'xview', 'scroll', count, what)
|
|
||||||
|
|
||||||
def yview(self):
|
|
||||||
return self._getdoubles(self.tk.call(self, 'yview'))
|
|
||||||
def yview_moveto(self, fraction):
|
|
||||||
self.tk.call(self,'ysview', 'moveto', fraction)
|
|
||||||
def yview_scroll(self, count, what="units"):
|
|
||||||
"Scroll down (count>0) or up <count> of units|pages"
|
|
||||||
self.tk.call(self, 'yview', 'scroll', count, what)
|
|
||||||
|
|
||||||
class ScrolledGrid(Grid):
|
class ScrolledGrid(Grid):
|
||||||
'''Scrolled Grid widgets'''
|
'''Scrolled Grid widgets'''
|
||||||
|
|
||||||
|
|
|
@ -1170,7 +1170,7 @@ class Sizegrip(Widget):
|
||||||
Widget.__init__(self, master, "ttk::sizegrip", kw)
|
Widget.__init__(self, master, "ttk::sizegrip", kw)
|
||||||
|
|
||||||
|
|
||||||
class Treeview(Widget):
|
class Treeview(Widget, tkinter.XView, tkinter.YView):
|
||||||
"""Ttk Treeview widget displays a hierarchical collection of items.
|
"""Ttk Treeview widget displays a hierarchical collection of items.
|
||||||
|
|
||||||
Each item has a textual label, an optional image, and an optional list
|
Each item has a textual label, an optional image, and an optional list
|
||||||
|
@ -1480,16 +1480,6 @@ class Treeview(Widget):
|
||||||
return self.tk.call(self._w, "tag", "has", tagname, item)
|
return self.tk.call(self._w, "tag", "has", tagname, item)
|
||||||
|
|
||||||
|
|
||||||
def xview(self, *args):
|
|
||||||
"""Query or modify horizontal position of the treeview."""
|
|
||||||
return self.tk.call(self._w, "xview", *args)
|
|
||||||
|
|
||||||
|
|
||||||
def yview(self, *args):
|
|
||||||
"""Query or modify vertical position of the treeview."""
|
|
||||||
return self.tk.call(self._w, "yview", *args)
|
|
||||||
|
|
||||||
|
|
||||||
# Extensions
|
# Extensions
|
||||||
|
|
||||||
class LabeledScale(Frame):
|
class LabeledScale(Frame):
|
||||||
|
|
|
@ -974,6 +974,9 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #1135: Add the XView and YView mix-ins to avoid duplicating
|
||||||
|
the xview* and yview* methods.
|
||||||
|
|
||||||
- Issue #6511: ZipFile now raises BadZipfile (instead of an IOError) when
|
- Issue #6511: ZipFile now raises BadZipfile (instead of an IOError) when
|
||||||
opening an empty or very small file.
|
opening an empty or very small file.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue