osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tkinter] question about correct use of validation


steve wrote:

> Il 16/01/19 08:51, Peter Otten ha scritto:
> 
>>      def make_ui(self):
>>          ''' create user interface '''
>> 
>>          def vcmd(maxlength):
>>              return self.parent.register(
>>                  partial(self.maxlength_validate, maxlength=maxlength)
>>              ), "%P"
>> 
> ...
> 
> ok following your advice and that of Rick in the previous post, I
> developed 2 solutions, one without classes and one with classes. I write
> to you if you need someone:

Two remarks:

>          self.id1_entry = self.make_entry(self.parent, maxlen=1).pack()

You set all idX_entry attributes to None, as that's what pack() returns.

>          apply(Entry.__init__, (self, master), kw)

You can write that in way compatible with Python 3 as

           Entry.__init__(self, master, **kw)

> Thank you all

You're welcome.