spyoungtech / FreeSimpleGUI

The free-forever GUI library
GNU Lesser General Public License v3.0
272 stars 35 forks source link

Optimize the association method between events and functions #26

Closed yunluo closed 2 weeks ago

yunluo commented 1 month ago

Currently, within the GUI library, one has to write a 'while True' loop and use 'if' statements to implement functionality. This method is usable but not elegant. I have created an additional library that uses decorators to associate events with functions. Can the GUI library be made to have a similar built-in mechanism?

spyoungtech commented 1 month ago

I'm not sure exactly what that may look like, but yes, I believe there is a lot of room to improve the provided event-driven patterns in the library.

yunluo commented 1 month ago

https://github.com/yunluo/pyguievent

A simple self-use event method that I wrote myself, I wrote poorly, I think you can write better