Page 1 of 1

wx.TextEntryDialog causes EventGhost to freeze

Posted: Mon Sep 13, 2010 9:02 pm
by enroto
Hello All,

I can't get the dialog wx.TextEntryDialog working under EventGhost Python Script plugin. Every time I'm trying to use it the EventGhost application freezes. I have tested this problem on different PC's and under different EventGhost versions. It is working correctly under Python Shell called PyCrust thou. Currently I'm working under Windows 7, EventGhost 0.3.7.r1436

Code: Select all


import wx

dlg = wx.TextEntryDialog(None, "Some text",'A Question', 'any text')
if dlg.ShowModal() == wx.ID_OK:
    response = dlg.GetValue()
dlg.Destroy()


Re: wx.TextEntryDialog causes EventGhost to freeze

Posted: Tue Sep 14, 2010 12:33 pm
by enroto
When running EventGhost with administrator privileges you can actually see the error message. Here you have a screenshot:
EventGhost crash.jpg

Re: wx.TextEntryDialog causes EventGhost to freeze

Posted: Tue Sep 14, 2010 1:04 pm
by Pako
This is a known problem but the solution is very simple.
You must use wx.CallAfter:

Code: Select all

class MyDialog():
    def __init__(self):
        dlg = wx.TextEntryDialog(None, "Some text",'A Question', 'any text')
        if dlg.ShowModal() == wx.ID_OK:
            response = dlg.GetValue()
            #here you can place your code
            print "response =",response
        else:
            print "Button Cancel pressed"
        dlg.Destroy()
wx.CallAfter(MyDialog)
Pako

Re: wx.TextEntryDialog causes EventGhost to freeze

Posted: Tue Sep 14, 2010 3:54 pm
by enroto
Good man! Thank you very much, Pako.

I did spend some time trying to find a solution but I failed. I was sure there is a bug in EventGhost, especially because the other wx.dialogs work fine. Your workaround works great. Until now I had to call external Python program from within EventGhost in order to get user input via TextEntryDialog. Apparently there is a long way ahead of me to get to know insideouts of EventGhost.

BTW
EventGhost is great, amazing in its simplicity and brilliant piece of software. I just love it.
I hate the idea that Bitmonster is going to leave the project but that's life.

enroto