Alt+Accels work on Linux but not on Windows 7 - Py3.6 wxPy4b2

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Alt+Accels work on Linux but not on Windows 7 - Py3.6 wxPy4b2

Mark Summerfield-2
The tiny attached program shows two buttons &Press and &Quit. On Xubuntu if I press Alt+P the first button is correctly pressed and if I press Alt+Q the application correctly terminates. But on Windows 7 (Py3.6, wxPy4b2) pressing Alt+P or Alt+Q has no effect at all. Yet both buttons work correctly using the mouse. Is this a bug or do I need to do something extra to switch this on in Windows?

(I don't know if it matters but I set Windows to always show Alt accelerator underlines.)

Thanks.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

wxeg.py (625 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Alt+Accels work on Linux but not on Windows 7 - Py3.6 wxPy4b2

Robin Dunn
On Thursday, October 19, 2017 at 8:05:00 AM UTC-7, Mark Summerfield wrote:
The tiny attached program shows two buttons &Press and &Quit. On Xubuntu if I press Alt+P the first button is correctly pressed and if I press Alt+Q the application correctly terminates. But on Windows 7 (Py3.6, wxPy4b2) pressing Alt+P or Alt+Q has no effect at all. Yet both buttons work correctly using the mouse. Is this a bug or do I need to do something extra to switch this on in Windows?

(I don't know if it matters but I set Windows to always show Alt accelerator underlines.)


Does it work if you put a panel in the frame, and put the buttons on the panel instead of directly in the frame?

-- 
Robin Dunn
Software Craftsman
http://wxPython.org

 

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Alt+Accels work on Linux but not on Windows 7 - Py3.6 wxPy4b2

Mark Summerfield-2
Oh, yes, I just added a wx.Panel(self) and made this panel the parent of the buttons and now the Alt-keys work on Windows.
I'll try it on the real application tomorrow...
Thanks!

On Thursday, October 19, 2017 at 5:14:21 PM UTC+1, Robin Dunn wrote:
On Thursday, October 19, 2017 at 8:05:00 AM UTC-7, Mark Summerfield wrote:
The tiny attached program shows two buttons &Press and &Quit. On Xubuntu if I press Alt+P the first button is correctly pressed and if I press Alt+Q the application correctly terminates. But on Windows 7 (Py3.6, wxPy4b2) pressing Alt+P or Alt+Q has no effect at all. Yet both buttons work correctly using the mouse. Is this a bug or do I need to do something extra to switch this on in Windows?

(I don't know if it matters but I set Windows to always show Alt accelerator underlines.)


Does it work if you put a panel in the frame, and put the buttons on the panel instead of directly in the frame?

-- 
Robin Dunn
Software Craftsman
<a href="http://wxPython.org" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2FwxPython.org\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHG9kM-NEpJfIvl_lWJvA23SuLjOA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2FwxPython.org\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHG9kM-NEpJfIvl_lWJvA23SuLjOA&#39;;return true;">http://wxPython.org

 

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Alt+Accels work on Linux but not on Windows 7 - Py3.6 wxPy4b2

Mark Summerfield-2
Thanks again, I've now done it to the real app and it works.

However, I'm a bit puzzled.

I have a class Form(wx.Frame) and I create a wx.Panel(self) where self is the form. And then I create all other widgets with the panel as their parent. Then, I create a GridBagSizer and put all the widgets in it. And at the end I call sizer.SetSizeHints(self) to pass on the size hints to the form and then self.panel.SetSizer(sizer) to put the sizer in the panel.

But... I haven't explicitly told wxPython to lay out the self.panel. Or is the fact that it is the only child of the form (wx.Frame) sufficient? (Well, yes, it is sufficient because it works---but is it _right_ to this?)

Thanks.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Alt+Accels work on Linux but not on Windows 7 - Py3.6 wxPy4b2

Tim Roberts
'Mark Summerfield' via wxPython-users wrote:

>
> However, I'm a bit puzzled.
>
> I have a class Form(wx.Frame) and I create a wx.Panel(self) where self
> is the form. And then I create all other widgets with the panel as
> their parent. Then, I create a GridBagSizer and put all the widgets in
> it. And at the end I call sizer.SetSizeHints(self) to pass on the size
> hints to the form and then self.panel.SetSizer(sizer) to put the sizer
> in the panel.
>
> But... I haven't explicitly told wxPython to lay out the self.panel.
> Or is the fact that it is the only child of the form (wx.Frame)
> sufficient? (Well, yes, it is sufficient because it works---but is it
> _right_ to this?)

Yes.  When a frame contains one child window, the child automatically
expands to fill the frame.  It's a feature.  ;)

--
Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Alt+Accels work on Linux but not on Windows 7 - Py3.6 wxPy4b2

Mark Summerfield-2
A very handy feature too:-) Thanks!

On Thursday, October 19, 2017 at 6:58:50 PM UTC+1, Tim Roberts wrote:
'Mark Summerfield' via wxPython-users wrote:

>
> However, I'm a bit puzzled.
>
> I have a class Form(wx.Frame) and I create a wx.Panel(self) where self
> is the form. And then I create all other widgets with the panel as
> their parent. Then, I create a GridBagSizer and put all the widgets in
> it. And at the end I call sizer.SetSizeHints(self) to pass on the size
> hints to the form and then self.panel.SetSizer(sizer) to put the sizer
> in the panel.
>
> But... I haven't explicitly told wxPython to lay out the self.panel.
> Or is the fact that it is the only child of the form (wx.Frame)
> sufficient? (Well, yes, it is sufficient because it works---but is it
> _right_ to this?)

Yes.  When a frame contains one child window, the child automatically
expands to fill the frame.  It's a feature.  ;)

--
Tim Roberts, <a href="javascript:" target="_blank" gdf-obfuscated-mailto="K8LSGqdqBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">ti...@...
Providenza & Boekelheide, Inc.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Alt+Accels work on Linux but not on Windows 7 - Py3.6 wxPy4b2

Mark Summerfield-2
Another reason for using a wx.Panel rather than laying out directly in a wx.Frame (at least for Windows), is that not only does this ensure that Alt+key accelerators work, but also that tabbing between widgets works (which it doesn't without the panel).

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.