Message279168
Funny thing, just today I came across the same issue.
So far I came up with an a little bit refined version of the OP's suggestions. Until now I have tested this with Python-2.7.9 and tk-8.6.0 on debian Jessie, I think the same code should work for Python-3 , too.
The busy_current() function here always reports only the root window (the same when called from within wish, apparently a bug in this early version of Tk-8.6) so I was not able to figure out how to use and test the "pattern" option.
def busy(self, **kw):
'''Shortcut for the busy_hold() command.'''
self.tk.call(('tk', 'busy', self._w) + self._options(kw))
def busy_cget(self, option):
'''Queries the busy command configuration options for
this window.
The window must have been previously made busy by
the busy_hold() command. Returns the present value
of the specified option. Option may have
any of the values accepted by busy_hold().'''
return(self.tk.call('tk', 'busy', 'cget', self._w, '-'+option))
def busy_configure(self, cnf=None, **kw):
'''Queries or modifies the tk busy command configuration
options. The window must have been previously made busy by
busy_hold(). Option may have any of the values accepted by
busy_hold().
Please note that the option database is referenced by the
window. For example, if a Frame widget is to be made busy,
the busy cursor can be specified for it by :
w.option_add("*Frame.BusyCursor", "gumby")'''
if kw:
cnf = _cnfmerge((cnf, kw))
elif cnf:
cnf = _cnfmerge(cnf)
if cnf is None:
return(self._getconfigure(
'tk', 'busy', 'configure', self._w))
if type(cnf) is StringType:
return(self._getconfigure1(
'tk', 'busy', 'configure', self._w, '-'+cnf))
self.tk.call((
'tk', 'busy', 'configure', self._w) + self._options(cnf))
busy_config = busy_configure
def busy_current(self, pattern=None):
'''Returns the widget objects of all widgets that are
currently busy.
If a pattern is given, only the path names of busy widgets
matching PATTERN are returned. '''
return([self._nametowidget(x) for x in
self.tk.splitlist(self.tk.call(
'tk', 'busy', 'current', self._w, pattern))])
def busy_forget(self):
'''Releases resources allocated by the busy() command for
this window, including the transparent window. User events will
again be received by the window. Resources are also released
when the window is destroyed. The window must have been
specified in the busy_hold() operation, otherwise an
exception is raised.'''
self.tk.call('tk', 'busy', 'forget', self._w)
def busy_hold(self, **kw):
'''Makes this window (and its descendants in the Tk window
hierarchy) appear busy. A transparent window is put in front
of the specified window. This transparent window is mapped
the next time idle tasks are processed, and the specified
window and its descendants will be blocked from user
interactions. Normally update() should be called immediately
afterward to insure that the hold operation is in effect before
the application starts its processing. The following
configuration options are valid:
-cursor cursorName
Specifies the cursor to be displayed when the widget
is made busy. CursorName can be in any form accepted
by Tk_GetCursor. The default cursor is "wait" on
Windows and "watch" on other platforms.'''
self.tk.call((
'tk', 'busy', 'hold', self._w) + self._options(kw))
def busy_status(self):
'''Returns the busy status of this window.
If the window presently can not receive user interactions,
True is returned, otherwise False.'''
return((self.tk.getboolean(self.tk.call(
'tk', 'busy', 'status', self._w)) and True) or False) |
|
Date |
User |
Action |
Args |
2016-10-21 23:10:03 | klappnase | set | recipients:
+ klappnase, serhiy.storchaka, tkinter |
2016-10-21 23:10:03 | klappnase | set | messageid: <1477091403.82.0.255247034214.issue28498@psf.upfronthosting.co.za> |
2016-10-21 23:10:03 | klappnase | link | issue28498 messages |
2016-10-21 23:10:03 | klappnase | create | |
|