I would like to open a new window from a main window button press but I am running into a couple of problems. The first problem is that I am getting several licenses created when I open my program:
Permanent license created on 2012-02-14 14:14:45.343000 for 000020
DEBUG:snap:Querying for remote addr
DEBUG:snap.dispatchers:send: 0001.callback('\x9a2\xfa\xeb\xb5\xe53\xff\xc1\xc54 D\x9eofa', 'getInfo', 3)
DEBUG:snap.dispatchers: Directing multi-cast to RS-232 Interface: 2
Permanent license created on 2012-02-14 14:14:45.343000 for 000020
Permanent license created on 2012-02-14 14:14:45.343000 for 000020
DEBUG:snap.dispatchers:rpc: 5d25b0.š2úëµå3ÿÁÅ4Džofa(19,)
DEBUG:snap:Next hop for RS-232 Interface: 2 is 5d25b0
DEBUG:snap.dispatchers:rpc: 5d25b0.š2úëµå3ÿÁÅ4Džofa(19,)
DEBUG:snap.dispatchers:Unable to find callable function š2úëµå3ÿÁÅ4Džofa
DEBUG:snap.dispatchers:rpc: 5d25b0.š2úëµå3ÿÁÅ4Džofa(19,)
DEBUG:snap.dispatchers:Unable to find callable function š2úëµå3ÿÁÅ4Džofa
Will I need a new licence for every window I open?
The next problem happens when I close the second window. The whole thing stops working and I get the error "Pythonw.exe has stopped working"
Code for main window:
Code for second window:
Please help.
Thank you
Permanent license created on 2012-02-14 14:14:45.343000 for 000020
DEBUG:snap:Querying for remote addr
DEBUG:snap.dispatchers:send: 0001.callback('\x9a2\xfa\xeb\xb5\xe53\xff\xc1\xc54 D\x9eofa', 'getInfo', 3)
DEBUG:snap.dispatchers: Directing multi-cast to RS-232 Interface: 2
Permanent license created on 2012-02-14 14:14:45.343000 for 000020
Permanent license created on 2012-02-14 14:14:45.343000 for 000020
DEBUG:snap.dispatchers:rpc: 5d25b0.š2úëµå3ÿÁÅ4Džofa(19,)
DEBUG:snap:Next hop for RS-232 Interface: 2 is 5d25b0
DEBUG:snap.dispatchers:rpc: 5d25b0.š2úëµå3ÿÁÅ4Džofa(19,)
DEBUG:snap.dispatchers:Unable to find callable function š2úëµå3ÿÁÅ4Džofa
DEBUG:snap.dispatchers:rpc: 5d25b0.š2úëµå3ÿÁÅ4Džofa(19,)
DEBUG:snap.dispatchers:Unable to find callable function š2úëµå3ÿÁÅ4Džofa
Will I need a new licence for every window I open?
The next problem happens when I close the second window. The whole thing stops working and I get the error "Pythonw.exe has stopped working"
Code for main window:
Code:
import wx import sys import os from snapconnect import snap import logging from nextWindow import Second BRIDGE_NODE = {'type':snap.SERIAL_TYPE_RS232, 'port':2} class MainWindow(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, -1, "Main Window", size=(200,200)) panel = wx.Panel(self, -1) self.child = Second(self, -1, None) self.child.Hide() self.poller = wx.Timer(self) self.Bind(wx.EVT_TIMER, lambda event : self.snap.poll()) self.poller.Start(20,wx.TIMER_CONTINUOUS) self.child = Second(self, -1, None) self.child.Hide() self.openSecond = wx.Button(panel, -1, "Open Second WIndow") self.Bind(wx.EVT_BUTTON, self.onOpenSecond, self.openSecond) self.dirname = "" funcdir = {} self.snap = snap.Snap(funcs = funcdir) self.snap.open_serial(BRIDGE_NODE['type'],BRIDGE_NODE['port'], forward_groups=0xFFFF) def onOpenSecond(self, event): self.child.Show() if __name__ == '__main__': app=wx.App() logging.basicConfig(level=logging.DEBUG) frame = MainWindow(None, -1, "") frame.Show(True) app.MainLoop()
Code:
import wx import sys import os from snapconnect import snap import logging BRIDGE_NODE = {'type':snap.SERIAL_TYPE_RS232, 'port':2} class Second(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, -1, "Second Window", size=(200,200)) panel = wx.Panel(self, -1) self.poller = wx.Timer(self) self.Bind(wx.EVT_TIMER, lambda event : self.snap.poll()) self.poller.Start(20,wx.TIMER_CONTINUOUS) self.closeSecond = wx.Button(panel, -1, "Close This WIndow") self.Bind(wx.EVT_BUTTON, self.onClose, self.closeSecond) self.dirname = "" funcdir = {} self.snap = snap.Snap(funcs = funcdir) self.snap.open_serial(BRIDGE_NODE['type'],BRIDGE_NODE['port'], forward_groups=0xFFFF) def onClose(self, event): self.Destroy() if __name__ == '__main__': app=wx.App() logging.basicConfig(level=logging.DEBUG) frame = Second(None, -1, "") frame.Show(True) app.MainLoop()
Thank you
Comment