From: Alex T. <al...@tw...> - 2004-12-28 17:27:31
|
Ruben Marquez wrote: >This is more a Python question than a PythonCard >question, but out of curiosity I did a quick search on >Comp.Lang.Python and found a possible solution: > >http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/f719f4199542b53f/26b0f980d3e12c4a?q=capture+key+press&_done=%2Fgroup%2Fcomp.lang.python%2Fsearch%3Fgroup%3Dcomp.lang.python%26q%3Dcapture+key+press%26qt_g%3D1%26searchnow%3DSearch+this+group%26&_doneTitle=Back+to+Search&&d#26b0f980d3e12c4a > >I haven't tested it. Hope it helps. > > No, it really is a PythonCard question. The thread you found is about console IO (or rather, standard input) for non-GUI applications. Detecting and handling input (such as "key" events) within wxPython (and PythonCard) is completely different. I believe the KEY events aren't handled for a grid component, so you need to do it directly in wxPython. As a simple example, I added the following at the end of on_initialize in the simplegrid.py sample that came with PythonCard. ## try binding key_down mygrid.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown) def OnKeyDown(self, evt): if evt.KeyCode() == wx.WXK_DELETE: print "Delete was pressed" evt.Skip() return and it does properly detect "delete" when pressed after selecting a row/column (and doesn't detect it when the delete is pressed within a cell editor). You can find some more examples in the wxPython Demo samples if you need it ... -- Alex. -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.298 / Virus Database: 265.6.4 - Release Date: 22/12/2004 |