0
我有一個對話框應用程序和一個框架應用程序(兩個文件),我希望它們互相交互。wxpython鏈接並打開新窗口應用程序
我想單擊我的對話框應用程序上的按鈕,它將關閉對話框應用程序並打開我的框架應用程序。任何想法如何我可以實現這一目標?
我的對話框的應用程序非常簡單,看起來像這樣
class ThisClass(wx.Dialog):
def __init__(self, parent, id, title):
wx.Dialog.__init__(self, parent, id, title, size=(APP_SIZE_X, APP_SIZE_Y))
wx.Button(self, 1, 'Start Monitoring', (50, 20), (120,-1))
wx.Button(self, 2, 'View Data', (50, 70), (120, -1))
wx.Button(self, 3, 'Close', (50, 120), (120, -1))
self.Bind(wx.EVT_BUTTON, self.idk1, id=1)
self.Bind(wx.EVT_BUTTON, self.idk2, id=2)
self.Bind(wx.EVT_BUTTON, self.clickClose, id=3)
self.Centre()
self.ShowModal()
def idk1(self,event):
#i want to launch another app here if
#this (Start Monitoring) button is pressed
def idk2(self, event):
self.Close(True)
def clickClose(self, event):
self.Close(True)
app = wx.App(0)
MyButtons(None, -1, 'buttons.py')
app.MainLoop()
感謝
你好,謝謝你的回覆。我做了類似於你的建議,我設法讓我的MyFrame(從其他文件)彈出,但我無法與它互動。小部件不能工作等 – lamba 2011-03-10 10:58:50
在你的其他文件中,創建一個函數app = MyFrame(0)和app.MainLoop(),然後調用該函數。這對我有效。 – Jake 2011-03-10 15:22:49