Manage GUI and logic interaction in Python

92 Views Asked by At

I developed a big python project, that does specific tasks. Later on I decided to add a graphical user interface for it.

├── GUI
|
└── myScript

Let's say the GUI has a "Start" button. When clicking on it, we start the business logic that is located in "myScript".

Currently I implemented the interaction this way:

Inside the GUI:

os.chdir("../myScript")
main.start() #calling the business function from myScript
os.chdir("../GUI")

I needed to add os.chdir because I had to deal with a lot of file reading and writing inside myScript. (I used absolute paths to find files)

I don't feel like this is the best way to link the presentation layer to the business layer. Is there a better way to do this in Python?

0

There are 0 best solutions below