Strange dialog behavior

Hello everyone,

I am having strange dialog behavior again (see thread http://aspn.activestate.com/ASPN/Mail/Message/wxpython-users/3657891)

If I create a dialog, hide it, and then call a wx.MessageDialog, it works the first time and then it no longer works. I have included an example below, to test it, listen on TCP port 4321 (under linux I use netcat):

nc -l -v -p 4321

and run the example, then in netcat press a key (a letter or number) and press enter, it should popup the wx.MessageDialog the first time and then it never does again, it gets lost in the wx.MessageDialog code. I originally had a Twisted example, (I found this while using Twisted & wx integration) but I wrote this pure (as in not having external libs) python example. Is this a bug (probably like the one I had before http://trac.wxwidgets.org/ticket/9909) or am I doing something strange? I also included my Twisted example at the very bottom

Thank you,
Gabriel

################### Pure python begin #######################

# -*- coding: utf-8 -*-

import wx, socket, sys

class TestDialog(wx.Frame):
       def __init__(self, parent=None, id=wx.ID_ANY, title="Test",
                 pos=wx.DefaultPosition, size=(300, 175), *args, **kwargs):
        wx.Frame.__init__(self, parent, id, title, pos, size, *args, **kwargs)
        panel = wx.Panel(self, wx.ID_ANY)
               wx.Button(panel, wx.ID_OK, " OK ", pos=(100, 115), size=wx.DefaultSize).SetDefault()
        self.Bind(wx.EVT_BUTTON, self.onOk, id=wx.ID_OK)
        self.srv = None
        self.Bind(wx.EVT_CLOSE, self.onOk)
           def onOk(self, error):
        """
        Called when a timeout error arrives
               @param error: the error msg
        @type error: C{str}
        """
        dlg = wx.MessageDialog(None, "Error : test", "Error", wx.OK | wx.ICON_ERROR)
        dlg.ShowModal()
        wx.CallAfter(dlg.Destroy)
   class TestApp(wx.App):

    def __init__(self, *args, **kwargs):
        wx.App.__init__(self, False, clearSigInt=False)
       def OnInit(self):
        self.gui = TestDialog()
        self.gui.Center(wx.BOTH)
        self.gui.Show(False)
        self.SetTopWindow(self.gui)
        return True
       def startedConnecting(self, connector):
        print 'Started to connect.'
       def buildProtocol(self, addr):
        print 'Connected.'
        p = TestService()
        p.factory = self
        return p
       def clientConnectionLost(self, connector, reason):
        print 'Lost connection. Reason:', reason
       def clientConnectionFailed(self, connector, reason):
        print 'Connection failed. Reason:', reason
        reactor.callLater(0, reactor.stop)

def listen(app):
       try:
        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    except socket.error, msg:
        sys.stderr.write("[ERROR] %s\n" % msg[1])
        sys.exit(1)
       try:
        sock.connect(("localhost", 4321))
    except socket.error, msg:
        sys.stderr.write("[ERROR] %s\n" % msg[1])
        sys.exit(2)
       while True:
        data = sock.recv(1024)
        print "got data"
        app.gui.onOk(None)
   if(__name__ == "__main__"):
    app = TestApp()
    listen(app)
   ################### Pure python end #######################
   ################### Twisted begin #######################

# -*- coding: utf-8 -*-

import wx
from twisted.internet import wxreactor
try:
    wxreactor.install()
except:
    pass
from twisted.internet import reactor
from twisted.internet.protocol import Protocol, ClientFactory

class TestDialog(wx.Frame):
       def __init__(self, parent=None, id=wx.ID_ANY, title="Test",
                 pos=wx.DefaultPosition, size=(300, 175), *args, **kwargs):
        wx.Frame.__init__(self, parent, id, title, pos, size, *args, **kwargs)
        panel = wx.Panel(self, wx.ID_ANY)
               wx.Button(panel, wx.ID_OK, " OK ", pos=(100, 115), size=wx.DefaultSize).SetDefault()
        self.Bind(wx.EVT_BUTTON, self.onOk, id=wx.ID_OK)
        self.srv = None
        self.Bind(wx.EVT_CLOSE, self.onOk)
           def onOk(self, error):
        dlg = wx.MessageDialog(None, "Error : test", "Error", wx.OK | wx.ICON_ERROR)
        dlg.ShowModal()
        dlg.Destroy
   class TestFactory(ClientFactory, wx.App):

    def __init__(self, *args, **kwargs):
        wx.App.__init__(self, False, clearSigInt=False)
       def OnInit(self):
        self.gui = TestDialog()
        self.gui.Center(wx.BOTH)
        self.gui.Show(False)
        self.SetTopWindow(self.gui)
        return True
       def startedConnecting(self, connector):
        print 'Started to connect.'
       def buildProtocol(self, addr):
        print 'Connected.'
        p = TestService()
        p.factory = self
        return p
       def clientConnectionLost(self, connector, reason):
        print 'Lost connection. Reason:', reason
       def clientConnectionFailed(self, connector, reason):
        print 'Connection failed. Reason:', reason
        reactor.callLater(0, reactor.stop)

class TestService(Protocol):
       def dataReceived(self, data):
        print "Received: %s" % str(data)
        self.factory.gui.onOk(None)
           def connectionMade(self):
        print "client connected"
   if(__name__ == "__main__"):
    f = TestFactory()
    reactor.connectTCP("localhost", 4321, f)
    reactor.registerWxApp(f)
    reactor.run()

################### Twisted end #######################

Gabriel Rossetti wrote:

Hello everyone,

I am having strange dialog behavior again (see thread ActiveState Community - Boosting coder and team productivity with ready-to-use open source languages and tools.)

If I create a dialog, hide it, and then call a wx.MessageDialog, it works the first time and then it no longer works. I have included an example below, to test it, listen on TCP port 4321 (under linux I use netcat):

nc -l -v -p 4321

and run the example, then in netcat press a key (a letter or number) and press enter, it should popup the wx.MessageDialog the first time and then it never does again, it gets lost in the wx.MessageDialog code. I originally had a Twisted example, (I found this while using Twisted & wx integration) but I wrote this pure (as in not having external libs) python example. Is this a bug (probably like the one I had before wxTrac has been migrated to GitHub Issues - wxWidgets) or am I doing something strange? I also included my Twisted example at the very bottom

Thank you,
Gabriel

################### Pure python begin #######################

# -*- coding: utf-8 -*-

import wx, socket, sys

class TestDialog(wx.Frame):
     def __init__(self, parent=None, id=wx.ID_ANY, title="Test",
                pos=wx.DefaultPosition, size=(300, 175), *args, **kwargs):
       wx.Frame.__init__(self, parent, id, title, pos, size, *args, **kwargs)
       panel = wx.Panel(self, wx.ID_ANY)
             wx.Button(panel, wx.ID_OK, " OK ", pos=(100, 115), size=wx.DefaultSize).SetDefault()
       self.Bind(wx.EVT_BUTTON, self.onOk, id=wx.ID_OK)
       self.srv = None
       self.Bind(wx.EVT_CLOSE, self.onOk)
         def onOk(self, error):
       """
       Called when a timeout error arrives
             @param error: the error msg
       @type error: C{str}
       """
       dlg = wx.MessageDialog(None, "Error : test", "Error", wx.OK | wx.ICON_ERROR)
       dlg.ShowModal()
       wx.CallAfter(dlg.Destroy)
  class TestApp(wx.App):

   def __init__(self, *args, **kwargs):
       wx.App.__init__(self, False, clearSigInt=False)
     def OnInit(self):
       self.gui = TestDialog()
       self.gui.Center(wx.BOTH)
       self.gui.Show(False)
       self.SetTopWindow(self.gui)
       return True
     def startedConnecting(self, connector):
       print 'Started to connect.'
     def buildProtocol(self, addr):
       print 'Connected.'
       p = TestService()
       p.factory = self
       return p
     def clientConnectionLost(self, connector, reason):
       print 'Lost connection. Reason:', reason
     def clientConnectionFailed(self, connector, reason):
       print 'Connection failed. Reason:', reason
       reactor.callLater(0, reactor.stop)

def listen(app):
     try:
       sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
   except socket.error, msg:
       sys.stderr.write("[ERROR] %s\n" % msg[1])
       sys.exit(1)
     try:
       sock.connect(("localhost", 4321))
   except socket.error, msg:
       sys.stderr.write("[ERROR] %s\n" % msg[1])
       sys.exit(2)
     while True:
       data = sock.recv(1024)
       print "got data"
       app.gui.onOk(None)
  if(__name__ == "__main__"):
   app = TestApp()
   listen(app)
  ################### Pure python end #######################
  ################### Twisted begin #######################

# -*- coding: utf-8 -*-

import wx
from twisted.internet import wxreactor
try:
   wxreactor.install()
except:
   pass
from twisted.internet import reactor
from twisted.internet.protocol import Protocol, ClientFactory

class TestDialog(wx.Frame):
     def __init__(self, parent=None, id=wx.ID_ANY, title="Test",
                pos=wx.DefaultPosition, size=(300, 175), *args, **kwargs):
       wx.Frame.__init__(self, parent, id, title, pos, size, *args, **kwargs)
       panel = wx.Panel(self, wx.ID_ANY)
             wx.Button(panel, wx.ID_OK, " OK ", pos=(100, 115), size=wx.DefaultSize).SetDefault()
       self.Bind(wx.EVT_BUTTON, self.onOk, id=wx.ID_OK)
       self.srv = None
       self.Bind(wx.EVT_CLOSE, self.onOk)
         def onOk(self, error):
       dlg = wx.MessageDialog(None, "Error : test", "Error", wx.OK | wx.ICON_ERROR)
       dlg.ShowModal()
       dlg.Destroy
  class TestFactory(ClientFactory, wx.App):

   def __init__(self, *args, **kwargs):
       wx.App.__init__(self, False, clearSigInt=False)
     def OnInit(self):
       self.gui = TestDialog()
       self.gui.Center(wx.BOTH)
       self.gui.Show(False)
       self.SetTopWindow(self.gui)
       return True
     def startedConnecting(self, connector):
       print 'Started to connect.'
     def buildProtocol(self, addr):
       print 'Connected.'
       p = TestService()
       p.factory = self
       return p
     def clientConnectionLost(self, connector, reason):
       print 'Lost connection. Reason:', reason
     def clientConnectionFailed(self, connector, reason):
       print 'Connection failed. Reason:', reason
       reactor.callLater(0, reactor.stop)

class TestService(Protocol):
     def dataReceived(self, data):
       print "Received: %s" % str(data)
       self.factory.gui.onOk(None)
         def connectionMade(self):
       print "client connected"
  if(__name__ == "__main__"):
   f = TestFactory()
   reactor.connectTCP("localhost", 4321, f)
   reactor.registerWxApp(f)
   reactor.run()

################### Twisted end #######################

hmmm, the indentation went wako on my on the post (mostly the 1st one), it's easy to figure out though

Gabriel

Gabriel Rossetti wrote:

Hello everyone,

I am having strange dialog behavior again (see thread ActiveState Community - Boosting coder and team productivity with ready-to-use open source languages and tools.)

If I create a dialog, hide it, and then call a wx.MessageDialog, it works the first time and then it no longer works. I have included an example below, to test it, listen on TCP port 4321 (under linux I use netcat):

nc -l -v -p 4321

and run the example, then in netcat press a key (a letter or number) and press enter, it should popup the wx.MessageDialog the first time and then it never does again, it gets lost in the wx.MessageDialog code.

Platform and version?

I notice you never call MainLoop. When do you expect events to be processed?

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

Gabriel Rossetti wrote:

Hello everyone,

I am having strange dialog behavior again (see thread ActiveState Community - Boosting coder and team productivity with ready-to-use open source languages and tools.)

If I create a dialog, hide it, and then call a wx.MessageDialog, it works the first time and then it no longer works. I have included an example below, to test it, listen on TCP port 4321 (under linux I use netcat):

nc -l -v -p 4321

and run the example, then in netcat press a key (a letter or number) and press enter, it should popup the wx.MessageDialog the first time and then it never does again, it gets lost in the wx.MessageDialog code.

Platform and version?

I notice you never call MainLoop. When do you expect events to be processed?

Linux, wxPython version 2.8.7.1-0

Yes, I forgot that in the first example (non-twisted), thanks, it's called in the twisted example through the twisted-wx integration (which is where I noticed this). I fixed the non-twisted example (it still has this problem):

# -*- coding: utf-8 -*-

import wx, socket, sys, threading
import wx.lib.newevent

ShowErrorEvent, SHOW_ERROR_EVENT_ID = wx.lib.newevent.NewEvent()

class TestDialog(wx.Frame):
       def __init__(self, parent=None, id=wx.ID_ANY, title="Test",
                 pos=wx.DefaultPosition, size=(300, 175), *args, **kwargs):
        wx.Frame.__init__(self, parent, id, title, pos, size, *args, **kwargs)
        self.Bind(SHOW_ERROR_EVENT_ID, self.onOk)
           def onOk(self, error):
        print "called onOk"
        dlg = wx.MessageDialog(None, "Error : test", "Error", wx.OK | wx.ICON_ERROR)
        dlg.ShowModal()
        wx.CallAfter(dlg.Destroy)
   class TestApp(wx.App):

    def __init__(self, *args, **kwargs):
        wx.App.__init__(self, False, clearSigInt=False)
       def OnInit(self):
        self.gui = TestDialog()
        self.gui.Center(wx.BOTH)
        self.gui.Show(False)
        self.SetTopWindow(self.gui)
        return True

class TestServer (threading.Thread):
       def __init__(self, app, *args, **kwargs):
        threading.Thread.__init__(self, *args, **kwargs)
        self.app = app
           def run (self):
        try:
            sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        except socket.error, msg:
            sys.stderr.write("[ERROR] %s\n" % msg[1])
            sys.exit(1)
               try:
            sock.connect(("localhost", 4321))
        except socket.error, msg:
            sys.stderr.write("[ERROR] %s\n" % msg[1])
            sys.exit(2)
               while True:
            data = sock.recv(1024)
            print "got data"
            evt = ShowErrorEvent()
            wx.PostEvent(self.app.gui, evt)
           
   if(__name__ == "__main__"):
    app = TestApp()
    TestServer(app).start()
    app.MainLoop()

Gabriel Rossetti wrote:

Robin Dunn wrote:

Gabriel Rossetti wrote:

Hello everyone,

I am having strange dialog behavior again (see thread ActiveState Community - Boosting coder and team productivity with ready-to-use open source languages and tools.)

If I create a dialog, hide it, and then call a wx.MessageDialog, it works the first time and then it no longer works. I have included an example below, to test it, listen on TCP port 4321 (under linux I use netcat):

nc -l -v -p 4321

and run the example, then in netcat press a key (a letter or number) and press enter, it should popup the wx.MessageDialog the first time and then it never does again, it gets lost in the wx.MessageDialog code.

Platform and version?

I notice you never call MainLoop. When do you expect events to be processed?

Linux, wxPython version 2.8.7.1-0

Yes, I forgot that in the first example (non-twisted), thanks, it's called in the twisted example through the twisted-wx integration (which is where I noticed this). I fixed the non-twisted example (it still has this problem):

# -*- coding: utf-8 -*-

import wx, socket, sys, threading
import wx.lib.newevent

ShowErrorEvent, SHOW_ERROR_EVENT_ID = wx.lib.newevent.NewEvent()

class TestDialog(wx.Frame):
     def __init__(self, parent=None, id=wx.ID_ANY, title="Test",
                pos=wx.DefaultPosition, size=(300, 175), *args, **kwargs):
       wx.Frame.__init__(self, parent, id, title, pos, size, *args, **kwargs)
       self.Bind(SHOW_ERROR_EVENT_ID, self.onOk)
         def onOk(self, error):
       print "called onOk"
       dlg = wx.MessageDialog(None, "Error : test", "Error", wx.OK | wx.ICON_ERROR)
       dlg.ShowModal()
       wx.CallAfter(dlg.Destroy)
  class TestApp(wx.App):

   def __init__(self, *args, **kwargs):
       wx.App.__init__(self, False, clearSigInt=False)
     def OnInit(self):
       self.gui = TestDialog()
       self.gui.Center(wx.BOTH)
       self.gui.Show(False)
       self.SetTopWindow(self.gui)
       return True

class TestServer (threading.Thread):
     def __init__(self, app, *args, **kwargs):
       threading.Thread.__init__(self, *args, **kwargs)
       self.app = app
         def run (self):
       try:
           sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
       except socket.error, msg:
           sys.stderr.write("[ERROR] %s\n" % msg[1])
           sys.exit(1)
             try:
           sock.connect(("localhost", 4321))
       except socket.error, msg:
           sys.stderr.write("[ERROR] %s\n" % msg[1])
           sys.exit(2)
             while True:
           data = sock.recv(1024)
           print "got data"
           evt = ShowErrorEvent()
           wx.PostEvent(self.app.gui, evt)
            if(__name__ == "__main__"):
   app = TestApp()
   TestServer(app).start()
   app.MainLoop()

Here's a new example with Twisted that uses the custom event technique I used in the non-Twisted example (also still has the problem):

####################### New Twisted Example #######################

# -*- coding: utf-8 -*-

import wx
import wx.lib.newevent
from twisted.internet import wxreactor
try:
    wxreactor.install()
except:
    pass
from twisted.internet import reactor
from twisted.internet.protocol import Protocol, ClientFactory

ShowErrorEvent, SHOW_ERROR_EVENT_ID = wx.lib.newevent.NewEvent()

class TestDialog(wx.Frame):
       def __init__(self, parent=None, id=wx.ID_ANY, title="Test",
                 pos=wx.DefaultPosition, size=(300, 175), *args, **kwargs):
        wx.Frame.__init__(self, parent, id, title, pos, size, *args, **kwargs)
        self.Bind(SHOW_ERROR_EVENT_ID, self.showError)
           def showError(self, error):
        print "called onOk"
        dlg = wx.MessageDialog(None, "Error : test", "Error", wx.OK | wx.ICON_ERROR)
        dlg.ShowModal()
        dlg.Destroy
   class TestFactory(ClientFactory, wx.App):

    def __init__(self, *args, **kwargs):
        wx.App.__init__(self, False, clearSigInt=False)
       def OnInit(self):
        self.gui = TestDialog()
        self.gui.Center(wx.BOTH)
        self.gui.Show(False)
        self.SetTopWindow(self.gui)
        return True
       def startedConnecting(self, connector):
        print 'Started to connect.'
       def buildProtocol(self, addr):
        print 'Connected.'
        p = TestService()
        p.factory = self
        return p
       def clientConnectionLost(self, connector, reason):
        print 'Lost connection. Reason:', reason
       def clientConnectionFailed(self, connector, reason):
        print 'Connection failed. Reason:', reason
        reactor.callLater(0, reactor.stop)

class TestService(Protocol):
       def dataReceived(self, data):
        print "Received: %s" % str(data)
        evt = ShowErrorEvent()
        wx.PostEvent(self.factory.gui, evt)
           def connectionMade(self):
        print "client connected"
   if(__name__ == "__main__"):
    f = TestFactory()
    reactor.connectTCP("localhost", 4321, f)
    reactor.registerWxApp(f)
    reactor.run()

Robin Dunn wrote:

Gabriel Rossetti wrote:

Hello everyone,

I am having strange dialog behavior again (see thread ActiveState Community - Boosting coder and team productivity with ready-to-use open source languages and tools.)

If I create a dialog, hide it, and then call a wx.MessageDialog, it works the first time and then it no longer works. I have included an example below, to test it, listen on TCP port 4321 (under linux I use netcat):

nc -l -v -p 4321

and run the example, then in netcat press a key (a letter or number) and press enter, it should popup the wx.MessageDialog the first time and then it never does again, it gets lost in the wx.MessageDialog code.

Platform and version?

I notice you never call MainLoop. When do you expect events to be processed?

Ok, I'll attach the code, since the cut-and-paste make the indent go crazy...wxBug.py is the non-Twisted version, wxTxBug.py is the twisted version.

Gabriel

wxBug.py (1.79 KB)

wxTxBug.py (2 KB)

Gabriel Rossetti wrote:

Robin Dunn wrote:

Gabriel Rossetti wrote:

Hello everyone,

I am having strange dialog behavior again (see thread ActiveState Community - Boosting coder and team productivity with ready-to-use open source languages and tools.)

If I create a dialog, hide it, and then call a wx.MessageDialog, it works the first time and then it no longer works. I have included an example below, to test it, listen on TCP port 4321 (under linux I use netcat):

nc -l -v -p 4321

and run the example, then in netcat press a key (a letter or number) and press enter, it should popup the wx.MessageDialog the first time and then it never does again, it gets lost in the wx.MessageDialog code.

Platform and version?

I notice you never call MainLoop. When do you expect events to be processed?

Linux, wxPython version 2.8.7.1-0

Yes, I forgot that in the first example (non-twisted), thanks, it's called in the twisted example through the twisted-wx integration (which is where I noticed this). I fixed the non-twisted example (it still has this problem):

It works for me with 2.8.9.1, I get repeated message dialogs for each enter keypress in netcat. However it does have a problem with shutting down as you don't have any code for sensing the termination of the connection from the server side. I added an event to handle that in the attachment.

socketclient.py (2.13 KB)

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

Gabriel Rossetti wrote:

Robin Dunn wrote:

Gabriel Rossetti wrote:

Hello everyone,

I am having strange dialog behavior again (see thread ActiveState Community - Boosting coder and team productivity with ready-to-use open source languages and tools.)

If I create a dialog, hide it, and then call a wx.MessageDialog, it works the first time and then it no longer works. I have included an example below, to test it, listen on TCP port 4321 (under linux I use netcat):

nc -l -v -p 4321

and run the example, then in netcat press a key (a letter or number) and press enter, it should popup the wx.MessageDialog the first time and then it never does again, it gets lost in the wx.MessageDialog code.

Platform and version?

I notice you never call MainLoop. When do you expect events to be processed?

Linux, wxPython version 2.8.7.1-0

Yes, I forgot that in the first example (non-twisted), thanks, it's called in the twisted example through the twisted-wx integration (which is where I noticed this). I fixed the non-twisted example (it still has this problem):

It works for me with 2.8.9.1, I get repeated message dialogs for each enter keypress in netcat. However it does have a problem with shutting down as you don't have any code for sensing the termination of the connection from the server side. I added an event to handle that in the attachment.

Ok, what OS did you test it on? Thanks for the code by the way.

Gabriel Rossetti wrote:

Robin Dunn wrote:

Gabriel Rossetti wrote:

Robin Dunn wrote:

Gabriel Rossetti wrote:

Hello everyone,

I am having strange dialog behavior again (see thread ActiveState Community - Boosting coder and team productivity with ready-to-use open source languages and tools.)

If I create a dialog, hide it, and then call a wx.MessageDialog, it works the first time and then it no longer works. I have included an example below, to test it, listen on TCP port 4321 (under linux I use netcat):

nc -l -v -p 4321

and run the example, then in netcat press a key (a letter or number) and press enter, it should popup the wx.MessageDialog the first time and then it never does again, it gets lost in the wx.MessageDialog code.

Platform and version?

I notice you never call MainLoop. When do you expect events to be processed?

Linux, wxPython version 2.8.7.1-0

Yes, I forgot that in the first example (non-twisted), thanks, it's called in the twisted example through the twisted-wx integration (which is where I noticed this). I fixed the non-twisted example (it still has this problem):

It works for me with 2.8.9.1, I get repeated message dialogs for each enter keypress in netcat. However it does have a problem with shutting down as you don't have any code for sensing the termination of the connection from the server side. I added an event to handle that in the attachment.

Ok, what OS did you test it on?

Ubuntu 8.04

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

Gabriel Rossetti wrote:

Robin Dunn wrote:

Gabriel Rossetti wrote:

Robin Dunn wrote:

Gabriel Rossetti wrote:

Hello everyone,

I am having strange dialog behavior again (see thread ActiveState Community - Boosting coder and team productivity with ready-to-use open source languages and tools.)

If I create a dialog, hide it, and then call a wx.MessageDialog, it works the first time and then it no longer works. I have included an example below, to test it, listen on TCP port 4321 (under linux I use netcat):

nc -l -v -p 4321

and run the example, then in netcat press a key (a letter or number) and press enter, it should popup the wx.MessageDialog the first time and then it never does again, it gets lost in the wx.MessageDialog code.

Platform and version?

I notice you never call MainLoop. When do you expect events to be processed?

Linux, wxPython version 2.8.7.1-0

Yes, I forgot that in the first example (non-twisted), thanks, it's called in the twisted example through the twisted-wx integration (which is where I noticed this). I fixed the non-twisted example (it still has this problem):

It works for me with 2.8.9.1, I get repeated message dialogs for each enter keypress in netcat. However it does have a problem with shutting down as you don't have any code for sensing the termination of the connection from the server side. I added an event to handle that in the attachment.

Ok, what OS did you test it on?

Ubuntu 8.04

May I ask how you upgraded it? I mean, is it an official upgrade because I only get 2.8.7.1-0ubuntu3 as the current version (on Ubuntu 8.04).

Gabriel Rossetti wrote:

Robin Dunn wrote:

Gabriel Rossetti wrote:

Robin Dunn wrote:

Gabriel Rossetti wrote:

Robin Dunn wrote:

Gabriel Rossetti wrote:

Hello everyone,

I am having strange dialog behavior again (see thread ActiveState Community - Boosting coder and team productivity with ready-to-use open source languages and tools.)

If I create a dialog, hide it, and then call a wx.MessageDialog, it works the first time and then it no longer works. I have included an example below, to test it, listen on TCP port 4321 (under linux I use netcat):

nc -l -v -p 4321

and run the example, then in netcat press a key (a letter or number) and press enter, it should popup the wx.MessageDialog the first time and then it never does again, it gets lost in the wx.MessageDialog code.

Platform and version?

I notice you never call MainLoop. When do you expect events to be processed?

Linux, wxPython version 2.8.7.1-0

Yes, I forgot that in the first example (non-twisted), thanks, it's called in the twisted example through the twisted-wx integration (which is where I noticed this). I fixed the non-twisted example (it still has this problem):

It works for me with 2.8.9.1, I get repeated message dialogs for each enter keypress in netcat. However it does have a problem with shutting down as you don't have any code for sensing the termination of the connection from the server side. I added an event to handle that in the attachment.

Ok, what OS did you test it on?

Ubuntu 8.04

May I ask how you upgraded it? I mean, is it an official upgrade because I only get 2.8.7.1-0ubuntu3 as the current version (on Ubuntu 8.04).

http://wiki.wxpython.org/InstallingOnUbuntuOrDebian

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

Gabriel Rossetti wrote:

Robin Dunn wrote:

Gabriel Rossetti wrote:

Robin Dunn wrote:

Gabriel Rossetti wrote:

Robin Dunn wrote:

Gabriel Rossetti wrote:

Hello everyone,

I am having strange dialog behavior again (see thread ActiveState Community - Boosting coder and team productivity with ready-to-use open source languages and tools.)

If I create a dialog, hide it, and then call a wx.MessageDialog, it works the first time and then it no longer works. I have included an example below, to test it, listen on TCP port 4321 (under linux I use netcat):

nc -l -v -p 4321

and run the example, then in netcat press a key (a letter or number) and press enter, it should popup the wx.MessageDialog the first time and then it never does again, it gets lost in the wx.MessageDialog code.

Platform and version?

I notice you never call MainLoop. When do you expect events to be processed?

Linux, wxPython version 2.8.7.1-0

Yes, I forgot that in the first example (non-twisted), thanks, it's called in the twisted example through the twisted-wx integration (which is where I noticed this). I fixed the non-twisted example (it still has this problem):

It works for me with 2.8.9.1, I get repeated message dialogs for each enter keypress in netcat. However it does have a problem with shutting down as you don't have any code for sensing the termination of the connection from the server side. I added an event to handle that in the attachment.

Ok, what OS did you test it on?

Ubuntu 8.04

May I ask how you upgraded it? I mean, is it an official upgrade because I only get 2.8.7.1-0ubuntu3 as the current version (on Ubuntu 8.04).

InstallingOnUbuntuOrDebian - wxPyWiki

Ok, thank you, I wasn't aware of that.

Robin Dunn wrote:

Gabriel Rossetti wrote:

Robin Dunn wrote:

Gabriel Rossetti wrote:

Hello everyone,

I am having strange dialog behavior again (see thread ActiveState Community - Boosting coder and team productivity with ready-to-use open source languages and tools.)

If I create a dialog, hide it, and then call a wx.MessageDialog, it works the first time and then it no longer works. I have included an example below, to test it, listen on TCP port 4321 (under linux I use netcat):

nc -l -v -p 4321

and run the example, then in netcat press a key (a letter or number) and press enter, it should popup the wx.MessageDialog the first time and then it never does again, it gets lost in the wx.MessageDialog code.

Platform and version?

I notice you never call MainLoop. When do you expect events to be processed?

Linux, wxPython version 2.8.7.1-0

Yes, I forgot that in the first example (non-twisted), thanks, it's called in the twisted example through the twisted-wx integration (which is where I noticed this). I fixed the non-twisted example (it still has this problem):

It works for me with 2.8.9.1, I get repeated message dialogs for each enter keypress in netcat. However it does have a problem with shutting down as you don't have any code for sensing the termination of the connection from the server side. I added an event to handle that in the attachment.

I confirm, after having upgraded Ubuntu's wxPython version using the instructions on the wxPython website (see OT thread), using version 2.8.9.1 whis problem does not occur.

Thanks again to Robin Dunn for his time and help.

Gabriel