[issue28498] tk busy command

Miguel report at bugs.python.org
Sat Oct 22 17:47:25 EDT 2016


Miguel added the comment:

Thanks klappnase for your collaboration.

I dont understand this function:
    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)

This pattern is not used in other functions that make use of self.tk.getboolean. These functions simply returns the value of self.tk.getboolean directly.

The code of your function busy_configure() is very similar to Misc._configure(). I think that you are duplicating code. Other functions related to configuration like pack_configure() and place_configure() simply use self._options(). For example:
    def pack_configure(self, cnf={}, **kw):
        self.tk.call(
              ('pack', 'configure', self._w)
              + self._options(cnf, kw))

    def place_configure(self, cnf={}, **kw):
        self.tk.call(
              ('place', 'configure', self._w)
              + self._options(cnf, kw))

I think that my proposal can do the job well. It follows the same pattern than the other functions:
    def tk_busy_configure(self, cnf=None, **kw):
        self.tk.call(('tk', 'busy', 'configure', self._w) + self._options(cnf, kw))

But I am not totally sure whether it's better to call directly Misc._configure or Misc._options in this situation.

Also if we follow the naming convention used in tkinter, it seems that we have to define first tk_busy_configure and then make this assignation:
     busy_configure = tk_busy_configure

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28498>
_______________________________________


More information about the Python-bugs-list mailing list