Il 17/01/19 14:08, Peter Otten ha scritto:
Alternatives:
- If you know that you'll always just call pack() you can change the
make_entry() method accordingly
def make_entry(...):
...
entry.pack()
return entry
- Write a helper function
def pack(widget):
widget.pack()
steve wrote:
> Il 17/01/19 14:08, Peter Otten ha scritto:
>
>> 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.
>
> you mean..
>
> self.idx_entry = self.make_entry(self.p
Il 17/01/19 14:08, Peter Otten ha scritto:
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.
you mean..
self.idx_entry = self.make_entry(self.parent, width=50, maxlen=30,
highligh
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)
>>
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
steve wrote:
> for determine the maximum number of characters in an entry
>
> I have read several interpretations for the solution of the problem, but
> I wanted to find an alternative way (for convenience of the code)
>
> I kindly ask for an opinion on the use of validation in this way.
>
> --
On 15/01/2019 14:16, Rick Johnson wrote:
steve wrote:
Then it's just a matter of passing a keyword argument:
myEntry = MyEntry(master, maxlen=20)
What you have above is a tightly coiled, steaming dogpile that will litter your
code base. Encapsulate that stench, would ya?
sure, everyth