[tkinter] question about correct use of validation

Peter Otten __peter__ at web.de
Thu Jan 17 08:08:26 EST 2019


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.




More information about the Python-list mailing list