Would consts for sequence strings be a good idea? #216
BloodyRain2k
started this conversation in
Ideas
Replies: 1 comment 2 replies
-
Hello,
I think that this is a good idea for widget custom events (or virtual events). As for the name of the constant in the class, I would like to be prefixed with "Event", something like: # ...
EventCalendarFrameDateSelected = "<<CalendarFrameDateSelected>>"
# ...
virtual_events = (CalendarFrame.EventCalendarFrameDateSelected,)
# ...
self.event_generate(CalendarFrame.EventCalendarFrameDateSelected) Let's see what other people thinks. Regards |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
There's one thing that I've so far found a little irritating with using tkinter, which is the sequence strings.
I understand that they're strings because as the name implies, they're not simple a 1-off name for something, so the choice for strings makes sense.
But I think in case of "custom" events the case is a little different. In my example the
CalendarFrame
's<<CalendarFrameDateSelected>>
event.Typing that one out and not making a typo is something, so I was wondering if it might be an idea to have such "fixed" event names as consts in the classes they belong to instead.
I've done a quick test here alejandroautalan/pygubu@master...BloodyRain2k:pygubu:sequence_const as example and to see if it'd even work, and from some quick testing it does seem to work.
But I'm primarily looking for feedback of everyone else here. It could be quite an effort to convert all events that pygubu adds, and if I'm the only one who even cares about that, then there'd be little point in making an effort over just converting each as I run into them.
Beta Was this translation helpful? Give feedback.
All reactions