So I broke down the program to it's very essentials, looks a bit messy, but I
hope it will do it.
What you have to do to provoke the error, is tho click on the run test
button, then change the value in the combobox and python will crash,
sometimes you have to repeat it two or three times, till you get the error.
What I also found is that if you don't bind the EVT_KILL_FOCUS event to the
combobox the crash won't happen.
Any glue what's wrong here??
-----run.py start------
import init_functions as iFunc
import wx
import inspect
import sys
class Testautomatisierung_HDD_Update(wx.Frame):
def __init__(self, parent, label, pos, size, frameno):
iFunc.InitWidgetLists(self, frameno)
wx.Frame.__init__(self, parent = parent, title = label, pos = pos,
size = size,
style=wx.MINIMIZE_BOX|wx.SYSTEM_MENU|wx.CAPTION|wx.CLOSE_BOX|wx.CLIP_CHILDREN)
if frameno==0:
self.Bind(wx.EVT_CLOSE, sys.exit)
iFunc.OnInit(self, frameno)
def OnButton(self, event):
pass
def OnCombo(self, event):
pass
def OnKillFocus(self, event):
pass
def main():
app = wx.App()
frame = Testautomatisierung_HDD_Update(None, 'Test Tool', (100, 30),
(860, 531), 0)
frame.Show()
frame.SetFocus()
app.MainLoop()
if __name__ == '__main__':
main()
-----run.py end------
-----init_functions.py start------
import wx
def InitWidgetLists(self, frameno):
if frameno == 0:
self.panels = []
self.buttons = []
self.comboboxes = []
self.notebooks = []
for i in range(0, 100):
self.panels.append(None)
self.buttons.append(None)
self.comboboxes.append(None)
self.notebooks.append(None)
self.aktstatus = None
def OnInit(self, frameno):
if frameno == 0:
PlaceTabInit(self, 0, 0, 'Main Menu')
PlaceButton(self, 0, 20, 'Run Test', (30, 390),(100, 25),
'BTN_20_Run_Test')
PlaceComboBox(self, 0, 1, choices = ['random', 'a', 'b'],
initvalue='random', pos=(175, 50), size=(140,20), name = 'CB_40_chose_map')
self.SetFocus()
def PlaceComboBox(self, panelno, comboboxno, choices, initvalue, pos, size,
name):
self.comboboxes[comboboxno] = wx.ComboBox(parent=self.panels[panelno],
choices=choices, pos = pos, size = size, name = name)
self.comboboxes[comboboxno].SetSelection
self.comboboxes[comboboxno].Value = initvalue
self.comboboxes[comboboxno].Bind(wx.EVT_KILL_FOCUS, self.OnKillFocus,
self.comboboxes[comboboxno])
def PlaceTabInit(self, frameno, notebookno, tabName):
self.notebooks[notebookno] = wx.Notebook(parent = self)
self.panels[0]= wx.Panel(self.notebooks[notebookno])
self.panels[0].SetBackgroundColour('standard')
self.notebooks[notebookno].AddPage(self.panels[0], tabName)
def PlaceButton(self, panelno, buttonno, label, pos, size, name):
self.buttons[buttonno] = wx.Button(parent = self.panels[panelno], label
= label, pos = pos, size = size, name = name)
self.buttons[buttonno].Bind(wx.EVT_BUTTON, self.OnButton,
self.buttons[buttonno])
-----init_functions.py end------
···
--
View this message in context: http://wxpython-users.1045709.n5.nabble.com/python-exe-crashs-when-accessing-combobox-tp5716977p5716996.html
Sent from the wxPython-users mailing list archive at Nabble.com.