Hi
I am a beginner of wxPython. I am trying to write a GUI plug-in in another freeware called TexGen (
http://texgen.sourceforge.net/index.php/Main_Page). TexGen has a Python interface to run Python script within the application. So I wrote a trial wxPython script. It was to run in TexGen to create a frame. Afterwards, some functions in TexGen became problematic, i.e. “file->save TexGen file” raising an error message - TexGenGUI.exe has encountered a problem and needs to close. I wonder anything can be done within wxpython script or I need to change TexGen setting. Really appreciate your time to help look at this issue.
I use Windows XP and WxPython2.8 installed for Python2.5. The script is below:
#################################################################################"
import wx
import sys
class MyFrame(wx.Frame):
def init(
self, parent, ID, title, pos=wx.DefaultPosition,
size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE
):
global data
wx.Frame.init(self, parent, ID, title, pos, size, style)
panel = wx.Panel(self)
c = wx.Button(panel, -1, “Close”, (95,100))
self.Bind(wx.EVT_BUTTON, self.OnCloseMe, c)
self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
def OnCloseMe(self, event):
self.Close(True)
def OnCloseWindow(self, event):
self.Destroy()
class App(wx.App):
def OnInit(self):
self.frame = MyFrame(None, -1, ‘Trial’, size = (300, 300))
self.frame.Show()
return True
···
#---------------------------------------------------------------------------
app = App()
try:
app.MainLoop()
finally:
del app
####################################################################################"
Many thanks
Xuesen