0
我使用Python工作在GUI上。我尝试了easyGUI(http://easygui.sourceforge.net/),除了我还没有找到同时显示两个窗口的方法,它工作得非常好。将wxPython与easyGUI结合使用,分别显示两个窗口
这是我在GNU/Linux的到目前为止已经试过:
from easygui import *
import wx
class FicheFrame(wx.Frame) :
def __init__(self, data) :
wx.Frame.__init__(self, None,-1, "Custom data", size=(300, 400))
self.d = data
scrollWin = wx.PyScrolledWindow(self, -1)
x = 20
y = 20
txtStr = self.d
stTxt = wx.StaticText(scrollWin, -1, txtStr, pos=(x, y))
w, h = stTxt.GetSize()
dy = h + 10
y += dy
scrollWin.SetScrollbars(0, dy, 0, y/dy+1)
scrollWin.SetScrollRate(1, 1)
myapp = wx.App(redirect=False)
myAppFrame = FicheFrame('data')
myAppFrame.Show()
exceptionbox(msg='Test test test', title=None)
myapp.MainLoop()
不幸的是,以前exceptionbox显示myAppFrame。当我关闭exceptionbox,然后myAppFrame出现,我不明白为什么,应该不是相反?
编辑: 按预期在Windows这项工作......
EDIT2:
其实,我用Tkinter的,而不是找到了一种方法......此代码的工作:
from easygui import *
from Tkinter import *
while True:
root = Tk()
w = Label(root, text="Hello, world!")
w.pack()
exceptionbox(msg='test test', title=None)
root.destroy()
root.mainloop()
del root
谢谢!我用Tkinter代替! – Bebe