简体   繁体   中英

Tkinter GUI for python script

I've got a design question here. My background is web programming, I'm not so familiar with GUIs so far.

I got a couple of command line python scripts and right now I'm looking into Tkinter to build some GUIs around them. In the examples and tutorials I've seen so far, that for simple scripts most people build a class for the GUI elements and add the functionality (logic) as methods to that class.

For scripts with a more complex logic I thought that it might be a good idea to split logic and user interface into different modules in some sort of a MVC fashion. One thing which came to my mind was having a module for tkinter (as frontend) and import the script module containing logic into this module (as backend).

It's probably worth mentioning, that I would try to avoid changes to my scripts,so to make sure for them to function from the command line as before.

What would be the most flexible and maintainable general approach in this case and what do people usually do here? Anyone who could suggest any good sources of information regarding GUI integration specifically?

Try this basic tutorial to get you started with tkinter, it's pretty simple once you got the first hang of it:

https://pythonworldsite.wordpress.com/2017/06/14/tkinter-part-1/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM