I am new to programming, started learning 8-9 months ago, i have
learned python and have been working with wxpython for 3-4 months now.
So please bear with me.
I am trying to build a grid where a cell gets automatic focus upon
pressing tab.
Right now the default behavior in the grid is that when i press TAB
the cursor moves to the next cell, the next cell is selected but i
have to click in it before i can enter a value.
Is there a way to make it to where when i press TAB, the next cell is
selected but also automatically be able to enter a value without
clicking on the cell?
I am new to programming, started learning 8-9 months ago, i have
learned python and have been working with wxpython for 3-4 months now.
So please bear with me.
I am trying to build a grid where a cell gets automatic focus upon
pressing tab.
Right now the default behavior in the grid is that when i press TAB
the cursor moves to the next cell, the next cell is selected but i
have to click in it before i can enter a value.
Is there a way to make it to where when i press TAB, the next cell is
selected but also automatically be able to enter a value without
clicking on the cell?
Hi,
I don't use the grid widget a lot, so take this with a grain of salt.
Playing with the GridSimple.py demo what you want seems to be default behaviour, i.e. tab to a cell one can directly enter data, if you want to edit data then you have to press F2.
Maybe look through the GridSimple.py sample and compare it with what you have done.
BTW you should be able to also activate the cell editor by typing, no click required. That initial keystroke should be injected into the edit control when it is shown, but at least in the past there were some issues with that for some types of editors.
But to answer your question, yes, the cell editor can be automatically enabled when a cell becomes current, and it is doable with just a couple lines of code. You just need to derive your grid subclass from both wx.grid.Grid, and wx.lib.mixins.grid.GridAutoEditMixin and call its __init__ method.
···
On 3/27/12 9:30 PM, VC wrote:
Hi,
I am new to programming, started learning 8-9 months ago, i have
learned python and have been working with wxpython for 3-4 months now.
So please bear with me.
I am trying to build a grid where a cell gets automatic focus upon
pressing tab.
Right now the default behavior in the grid is that when i press TAB
the cursor moves to the next cell, the next cell is selected but i
have to click in it before i can enter a value.
Is there a way to make it to where when i press TAB, the next cell is
selected but also automatically be able to enter a value without
clicking on the cell?
PS: how do i activate the editor with a key stroke, the default
behavior does not activate it with key strokes.
VC
···
On Mar 28, 1:19 pm, Robin Dunn <ro...@alldunn.com> wrote:
On 3/27/12 9:30 PM, VC wrote:
> Hi,
> I am new to programming, started learning 8-9 months ago, i have
> learned python and have been working with wxpython for 3-4 months now.
> So please bear with me.
> I am trying to build a grid where a cell gets automatic focus upon
> pressing tab.
> Right now the default behavior in the grid is that when i press TAB
> the cursor moves to the next cell, the next cell is selected but i
> have to click in it before i can enter a value.
> Is there a way to make it to where when i press TAB, the next cell is
> selected but also automatically be able to enter a value without
> clicking on the cell?
BTW you should be able to also activate the cell editor by typing, no
click required. That initial keystroke should be injected into the edit
control when it is shown, but at least in the past there were some
issues with that for some types of editors.
But to answer your question, yes, the cell editor can be automatically
enabled when a cell becomes current, and it is doable with just a couple
lines of code. You just need to derive your grid subclass from both
wx.grid.Grid, and wx.lib.mixins.grid.GridAutoEditMixin and call its
__init__ method.
--
Robin Dunn
Software Craftsmanhttp://wxPython.org- Hide quoted text -
If i make an instance of wx.grid.Grid, tab to a cell and start typing
it does nothing. No data is transferred to the cell. Also F2 does not
activate the editor. To my knowledge i have the latest build of
wxpython, why do i not have that default behavior?
thanks
VC
···
On Mar 28, 6:17 pm, Robin Dunn <ro...@alldunn.com> wrote:
On 3/28/12 12:55 PM, VC wrote:
> Great it worked.
> Thank you very much.
> PS: how do i activate the editor with a key stroke, the default
> behavior does not activate it with key strokes.
Just start typing. It works for at least normal text cell editors. The
F2 key should also activate the editor.
--
Robin Dunn
Software Craftsmanhttp://wxPython.org
Does it work in the demo? I just tried mine and it did. I’m using wxPython 2.9.3, Python 2.6 on Windows 7. If it does work in the demo, then compare its code with your own.
Mike
···
On Wednesday, March 28, 2012 11:45:19 PM UTC-5, VC wrote:
If i make an instance of wx.grid.Grid, tab to a cell and start typing
it does nothing. No data is transferred to the cell. Also F2 does not
activate the editor. To my knowledge i have the latest build of
wxpython, why do i not have that default behavior?
It works in the demo. I do not see any difference in the code for the
grid. I have wxpython 2.8 1 version older than the demo. I did install
wxpython 2.9 and still it did not work. Driving me nuts. I had to
reinstall wxpython2.8 because the radiobox changed and was not showing
the options. it seems the choices parameter changed from a list to
wxPyArrayEmptyString or something. I have no idea what that is.
VC
···
On Mar 29, 9:44 am, Mike Driscoll <kyoso...@gmail.com> wrote:
On Wednesday, March 28, 2012 11:45:19 PM UTC-5, VC wrote:
> If i make an instance of wx.grid.Grid, tab to a cell and start typing
> it does nothing. No data is transferred to the cell. Also F2 does not
> activate the editor. To my knowledge i have the latest build of
> wxpython, why do i not have that default behavior?
> thanks
> VC
Does it work in the demo? I just tried mine and it did. I'm using wxPython
2.9.3, Python 2.6 on Windows 7. If it does work in the demo, then compare
its code with your own.
Thanks all, i figured out the problem, it is working now. I had bound
the wx.EVT_CHAR of the grid to a function which disable that behavior.
now it is fixed.
Thanks all for your input.
VC
···
On Mar 30, 5:03 pm, VC <napoleon...@gmail.com> wrote:
Hi Mike,
It works in the demo. I do not see any difference in the code for the
grid. I have wxpython 2.8 1 version older than the demo. I did install
wxpython 2.9 and still it did not work. Driving me nuts. I had to
reinstall wxpython2.8 because the radiobox changed and was not showing
the options. it seems the choices parameter changed from a list to
wxPyArrayEmptyString or something. I have no idea what that is.
VC
On Mar 29, 9:44 am, Mike Driscoll <kyoso...@gmail.com> wrote:
> On Wednesday, March 28, 2012 11:45:19 PM UTC-5, VC wrote:
> > If i make an instance of wx.grid.Grid, tab to a cell and start typing
> > it does nothing. No data is transferred to the cell. Also F2 does not
> > activate the editor. To my knowledge i have the latest build of
> > wxpython, why do i not have that default behavior?
> > thanks
> > VC
> Does it work in the demo? I just tried mine and it did. I'm using wxPython
> 2.9.3, Python 2.6 on Windows 7. If it does work in the demo, then compare
> its code with your own.
It should still autoconvert from a python list of strings. Can you duplicate the problem in a small sample?
···
On 3/30/12 3:03 PM, VC wrote:
Hi Mike,
It works in the demo. I do not see any difference in the code for the
grid. I have wxpython 2.8 1 version older than the demo. I did install
wxpython 2.9 and still it did not work. Driving me nuts. I had to
reinstall wxpython2.8 because the radiobox changed and was not showing
the options. it seems the choices parameter changed from a list to
wxPyArrayEmptyString or something. I have no idea what that is.
Are we talking about the RadioBox not showing the options in python
version 2.9?
Is that the sample code you wanted?
Can i please know what a string array is in version 2.9 for the
radiobox? and how it looks like?
Thank you
VC
···
On Apr 1, 1:38 pm, Robin Dunn <ro...@alldunn.com> wrote:
On 3/30/12 3:03 PM, VC wrote:
> Hi Mike,
> It works in the demo. I do not see any difference in the code for the
> grid. I have wxpython 2.8 1 version older than the demo. I did install
> wxpython 2.9 and still it did not work. Driving me nuts. I had to
> reinstall wxpython2.8 because the radiobox changed and was not showing
> the options. it seems the choices parameter changed from a list to
> wxPyArrayEmptyString or something. I have no idea what that is.
It should still autoconvert from a python list of strings. Can you
duplicate the problem in a small sample?
--
Robin Dunn
Software Craftsmanhttp://wxPython.org
On Mon, Apr 2, 2012 at 8:47 AM, VC <napoleonics@gmail.com> wrote:
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
In python 2.9 my radiobox code does not show the options whereas that
same code in python 2.8 works just fine.
In looking to see if anything changed, in python 2.8 the choices
parameter for the radiobox is stated as a list, whereas in 2.9 it is
stated as a wx.StringArray or something of the sort and i did not
understand what that was.
The radiobox loads in python 2.9, the frame is there and everything,
just not the options.
The 2.9.3 demo for RadioBox and it works for me on Win7 with Py 2.7.
Only difference I see is that you keywords and the demo doens't, but when I changed to keywords it still works for me.
Does the demo work for you?
Werner
···
On 02/04/2012 18:19, VC wrote:
it should be the same - what's not working?
In python 2.9 my radiobox code does not show the options whereas that
same code in python 2.8 works just fine.
In looking to see if anything changed, in python 2.8 the choices
parameter for the radiobox is stated as a list, whereas in 2.9 it is
stated as a wx.StringArray or something of the sort and i did not
understand what that was.
The radiobox loads in python 2.9, the frame is there and everything,
just not the options.
I do not have the 2.9.3 demo, i will downloaded tonight and try it.
I kept saying before python 2.8 and python2.9 whereas i meant wxpython
2.8 and wxpython 2.9
VC
···
On Apr 2, 12:16 pm, Werner <werner.bru...@sfr.fr> wrote:
On 02/04/2012 18:19, VC wrote:
>> it should be the same - what's not working?
> In python 2.9 my radiobox code does not show the options whereas that
> same code in python 2.8 works just fine.
> In looking to see if anything changed, in python 2.8 the choices
> parameter for the radiobox is stated as a list, whereas in 2.9 it is
> stated as a wx.StringArray or something of the sort and i did not
> understand what that was.
> The radiobox loads in python 2.9, the frame is there and everything,
> just not the options.
Yes i saw that but it was not working for me.
I will redownload wxpython 2.9 and try a sample code to see if it
works, i will post the results tonight.
if i understood it correctly from what others posted a string array is
basically a sequence of string? meaning a list of strings, tuple of
strings or dict of strings. Is that correct?
VC
···
On Apr 2, 12:10 pm, Werner <werner.bru...@sfr.fr> wrote:
On 02/04/2012 17:47, VC wrote:> I had looked at that and other online docs but still did not get how
> to define a string array.
You missed a sentence in Robin's reply:)
"It should still autoconvert from a python list of strings"
In my other program that i am writing that it is 500 lines long, i
have a similar implementation of the radiobox code and it does not
work.
That same code however displays a correct radiobox in wxpython 2.8.