Question

I work on a GUI with Python. I tried easyGUI (http://easygui.sourceforge.net/) and it works really good except I have not found a way to show two windows simultaneously.

This is what I have tried so far in 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()

Unfortunately, the exceptionbox shows before myAppFrame. When I close exceptionbox, then myAppFrame appears, I don't understand why, should'nt it be the opposite?

EDIT: This work as intended in Windows!...

EDIT2:

I actually found a way by using Tkinter instead... this code works:

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
Was it helpful?

Solution

EasyGUI is based on Tkinter and is basically a set of dialogs. I wouldn't mix Tkinter and wxPython. Instead, just create the dialogs in wx. Most of the dialogs that EasyGUI has have equivalents in wxPython or can be created with a simple subclass of wx.Dialog. See:

And check out the MessageDialog or GenericMessageDialog

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top