Some versions before I forget, ok at least the RPMs I've got installed.
wxPython-gl-2.3.2.1-1
wxGTK-2.3.2-1
wxGTK-gl-2.3.2-1
wxPython-2.3.2.1-1
Let's start with kudos for a pretty spiffy product of someone's serious
effort. I've been aware of Python for a few years but never really did
more than play with it. I discovered wxPython just before a job
application a year or so ago. Two weeks ago I decided to try a non
trivial but not too serious GUI and I have to say that I'm pretty
impressed with wxPython. I've used TCL/Tk in the past and I always felt
like I was fighting the implementation or the docs. With wxPython I've
managed to put together a basic GUI from scratch and it looks very much
like a "real" application. So I have to say thanks to anyone reading
this who's actually involved in the production of wxPython.
And I am seeking guidance on a couple of things. The first is a
question of the "right way" to do something. The second is too actually
but it's more of a feedback issue.
First let me say that what I would like is a little single line entry
widget with a simple history mechanism, you know a place for the user to
type in commands and be able to whizz up and down them with the cursor
keys for selecting a previously entered string. I thought about a
ComboBox but the binding seemed to be all wrong and I'm not clear on how
to change existing bindings. So what I did was use a TextCtrl and try
to add an event handler to filter out WXK_UP and down and simply change
the control's value:
聽聽聽聽聽聽聽聽input = wxTextCtrl(self, id, style = wxTE_PROCESS_ENTER)
聽聽聽聽聽聽聽聽EVT_CHAR(input, self.OnChar)
....
聽聽聽聽def OnChar(self, event):
聽聽聽聽聽聽聽聽if event.KeyCode() in [ WXK_UP, WXK_DOWN ] and len(self.cmds):
聽聽聽聽聽聽聽聽聽聽聽聽wxPostEvent(self.input, HistoryEvent(event.KeyCode()))
聽聽聽聽聽聽聽聽else:
聽聽聽聽聽聽聽聽聽聽聽聽event.Skip()
聽聽聽聽def HistSub(self, event):
聽聽聽聽聽聽聽聽if event.data == WXK_UP:
聽聽聽聽聽聽聽聽聽聽聽聽cmd = self.cmds.prev
聽聽聽聽聽聽聽聽else:
聽聽聽聽聽聽聽聽聽聽聽聽cmd = self.cmds.next
聽聽聽聽聽聽聽聽i = self.input.GetInsertionPoint()
聽聽聽聽聽聽聽聽self.input.SetValue(cmd())
聽聽聽聽聽聽聽聽self.input.SetInsertionPoint(i)
The problem is that when I do this I get a segmentation fault when
running. I added the extra event in case it helped on the basis that it
might be a timing related issue. It didn't really change much, maybe
the frequency of the faults.
So the first question is Is there a(nother| better) way of achieving the
goal? Should I really try altering the bindings for the ComboBox
instead?
The second is that regardless of the nature of my stupidity I consider
the segfault a bug. (BTW removing just the history portion allows the
application to run for extended periods so I think it's pretty certain
to be wxPython/wxWindows rather than Python or libc) So does anyone
have any pointers for things to do to make the report more palatable?
And what might help narrow it down a bit more? And what the most
appropriate forum for recording it is?
All help appreciated.
Cheers.