[Tkinter-discuss] ttk.Spinbox missing?

Douglas S. Blank dblank at cs.brynmawr.edu
Wed Jun 13 15:34:57 CEST 2012


On 06/13/2012 08:55 AM, Mark Summerfield wrote:
> Hi Michael,
>
> On Wed, 13 Jun 2012 14:12:10 +0200
> Michael Lange<klappnase at web.de>  wrote:
> [snip]
>> I don't know who currently maintains Tkinter and how much time they have
>> to work on it, maybe it would help if someone wrote a patch.
>> > From a quick glance I think the spinbox might not require any more code
>> than the following snippet:
>>
>> #################################################################
>> import ttk
>>
>> class Spinbox(ttk.Entry):
>>
>>      def __init__(self, master=None, **kw):
>>          ttk.Entry.__init__(self, master, "ttk::spinbox", **kw)
>>
>>      def current(self, newindex=None):
>>          return self.tk.call(self._w, 'current', index)
>>
>>      def set(self, value):
>>          return self.tk.call(self._w, 'set', value)
>> #################################################################
>>
>> Can you store this to a file spinbox.py and then import the spinbox
>> widget from there and test if everything works? Maybe there still needs
>> some tweaking to be done to make all configuration options work properly
>> (as in ttk.Combobox).
>
> I didn't check "everything", but I tried it and it worked. I respects
> the from and to values (when using the up and down arrows or the up and
> down arrow keys), but just like tk.Spinbox allows you to type in any old
> junk.
>

It does look like there is an error in current(): there is a newindex 
and index, but it doesn't look like index is defined, right?

-Doug

-- 
Douglas S. Blank, Associate Professor and Chair
Department of Computer Science, Bryn Mawr College
http://cs.brynmawr.edu/~dblank  (610)526-6501


More information about the Tkinter-discuss mailing list