Python link two separate GUIs on physically different computers

只愿长相守 提交于 2020-01-17 18:13:09

问题


Suppose I have two separate files,

e.g. customerorder.py and employeeside.py

customerorder.py gathers the customer order and employeeside.py displays the queue of orders.

Conceptually, these would run on two separate screens inside a coffee shop.

However, when i import employeeside.py from customerorder.py, it displays the employeeside.py GUI instead. I need to import the file as I am calling a function in employeeside.py when from the customerorder.py file. Is there a way to run the specific module in one file without running the whole file? I understand I could do 'from emplyeeside import ...', but this still runs the whole file.

Also, would using a MYSQL client-served database where both programs connect to the database on the network allow for the two separate GUIs to be connected even if physically on two separate computers

#Customerside.py
class PageTwo(tk.Frame):

        def __init__(self, parent, controller):
            tk.Frame.__init__(self, parent)

            def restartApplicationFromEmployee():
                start = EmployeeFrontend.baristaPage()
                start.startQueue()

            self.payButton1 = tk.Button(self,image=self.payImage1,command=restartApplicationFromEmployee)
            self.payButton1.place(x=730,y=690)

#Baristaside.py
class baristaPage(tk.Frame):

def __init__(self, parent, controller):
    tk.Frame.__init__(self,parent)

    def startQueue():
        baristaPage.queue1 = Queue() #instantiating queue class
        baristaPage.queue1.enqueue() #running method
        #GUI for queue
        root = Tk()
        my_gui = MyFirstGUI(root)
        root.mainloop()

To note, the class named Queue() reads the records in from the database of the customer orders which were recorded in the database when they payed

The class MyFirstGGUI displays the contents of the Queue() class visually

来源:https://stackoverflow.com/questions/59533932/python-link-two-separate-guis-on-physically-different-computers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!