Numeric keypad disabled for TextCtrl input (X11 backend, server on Windows)

I’m working on an application that needs to support multiple platforms. It uses a simple wx.TextCtrl to get user input, which works fine when the code runs on Windows 7 using the native backend. But running on a Linux host (Ubuntu 3.8.0) with the display on my Windows box using the CygWin X11 server, the numeric keypad does nothing. And yes, “Num Lock” is on in both cases.

At this point, I’m even having trouble getting key events from the control. I get the EVT_TEXT_ENTER event just fine, but nothing gets called on EVT_CHAR, EVT_KEY_UP, and EVT_KEY_DOWN, even for keys on the main keyboard. On Windows, all events arrive as expected.

Any hints as to what I’m doing wrong?

  • Stephen

TextCtrl_test.py (1.54 KB)

Add a Panel;
import wx

class Mywin(wx.Frame):

def init(self, parent, title):

super(Mywin, self).init(parent, title = title,size = (350,250))

panel = wx.Panel(self)

vbox = wx.BoxSizer(wx.VERTICAL)

hbox1 = wx.BoxSizer(wx.HORIZONTAL)

l1 = wx.StaticText(panel, -1, “Text Field”)

hbox1.Add(l1, 1, wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

self.t1 = wx.TextCtrl(panel)

hbox1.Add(self.t1,1,wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

self.t1.Bind(wx.EVT_TEXT,self.OnKeyTyped)

vbox.Add(hbox1)

hbox2 = wx.BoxSizer(wx.HORIZONTAL)

l2 = wx.StaticText(panel, -1, “password field”)

hbox2.Add(l2, 1, wx.ALIGN_LEFT|wx.ALL,5)

self.t2 = wx.TextCtrl(panel,style = wx.TE_PASSWORD)

self.t2.SetMaxLength(5)

hbox2.Add(self.t2,1,wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

vbox.Add(hbox2)

self.t2.Bind(wx.EVT_TEXT_MAXLEN,self.OnMaxLen)

hbox3 = wx.BoxSizer(wx.HORIZONTAL)

l3 = wx.StaticText(panel, -1, “Multiline Text”)

hbox3.Add(l3,1, wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

self.t3 = wx.TextCtrl(panel,size = (200,100),style = wx.TE_MULTILINE)

hbox3.Add(self.t3,1,wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

vbox.Add(hbox3)

self.t3.Bind(wx.EVT_TEXT_ENTER,self.OnEnterPressed)

hbox4 = wx.BoxSizer(wx.HORIZONTAL)

l4 = wx.StaticText(panel, -1, “Read only text”)

hbox4.Add(l4, 1, wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

self.t4 = wx.TextCtrl(panel, value = “ReadOnly Text”,style = wx.TE_READONLY|wx.TE_CENTER)

hbox4.Add(self.t4,1,wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

vbox.Add(hbox4)

panel.SetSizer(vbox)

self.Centre()

self.Show()

self.Fit()

def OnKeyTyped(self, event):

print event.GetString()

def OnEnterPressed(self,event):

print “Enter pressed”

def OnMaxLen(self,event):

print “Maximum length reached”

app = wx.App()

Mywin(None, ‘TextCtrl demo’)

app.MainLoop()

···

On Tue, Jan 17, 2017 at 9:12 AM, swestin@grammatech.com wrote:

I’m working on an application that needs to support multiple platforms. It uses a simple wx.TextCtrl to get user input, which works fine when the code runs on Windows 7 using the native backend. But running on a Linux host (Ubuntu 3.8.0) with the display on my Windows box using the CygWin X11 server, the numeric keypad does nothing. And yes, “Num Lock” is on in both cases.

At this point, I’m even having trouble getting key events from the control. I get the EVT_TEXT_ENTER event just fine, but nothing gets called on EVT_CHAR, EVT_KEY_UP, and EVT_KEY_DOWN, even for keys on the main keyboard. On Windows, all events arrive as expected.

Any hints as to what I’m doing wrong?

  • Stephen

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 wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Putting the TextCtrl in a Panel does not change behavior.

Changing from wx.EVT_CHAR to wx.EVT_TEXT as used in your code, makes the events show up, whether I use a Panel or not.

But not for keys in the numeric keypad; they don’t alter the text (TextCtrl.GetValue()), so no EVT_TEXT.

I need to get keystrokes from the numeric keypad and convert them to digits. Better yet, I would love to persuade wxPython (wxWidgets, X11…) to do this for me.

···

On Wednesday, January 18, 2017 at 11:32:32 AM UTC-5, johnf wrote:

Add a Panel;

You might try capturing EVT_KEY_DOWN. I seem to recall
EVT_KEY_DOWN working differently than EVT_CHAR, and there are key
codes for the Numpad keys, so you can detect their press whether
NUMLOCK is pressed or not. See
for more
detail.

David

···

https://wxpython.org/docs/api/wx.KeyEvent-class.html
On 01/18/2017 10:32 AM, John Fabiani
wrote:

Add a Panel;
import wx

class Mywin(wx.Frame):

def init(self, parent, title):

        super(Mywin, self).__init__(parent, title =

title,size = (350,250))

panel = wx.Panel(self)

vbox = wx.BoxSizer(wx.VERTICAL)

hbox1 = wx.BoxSizer(wx.HORIZONTAL)

l1 = wx.StaticText(panel, -1, “Text Field”)

        hbox1.Add(l1, 1,

wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

self.t1 = wx.TextCtrl(panel)

hbox1.Add(self.t1,1,wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

self.t1.Bind(wx.EVT_TEXT,self.OnKeyTyped)

vbox.Add(hbox1)

hbox2 = wx.BoxSizer(wx.HORIZONTAL)

l2 = wx.StaticText(panel, -1, “password field”)

hbox2.Add(l2, 1, wx.ALIGN_LEFT|wx.ALL,5)

        self.t2 = wx.TextCtrl(panel,style =

wx.TE_PASSWORD)

self.t2.SetMaxLength(5)

hbox2.Add(self.t2,1,wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

vbox.Add(hbox2)

self.t2.Bind(wx.EVT_TEXT_MAXLEN,self.OnMaxLen)

hbox3 = wx.BoxSizer(wx.HORIZONTAL)

l3 = wx.StaticText(panel, -1, “Multiline Text”)

        hbox3.Add(l3,1,

wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

        self.t3 = wx.TextCtrl(panel,size =

(200,100),style = wx.TE_MULTILINE)

hbox3.Add(self.t3,1,wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

vbox.Add(hbox3)

self.t3.Bind(wx.EVT_TEXT_ENTER,self.OnEnterPressed)

hbox4 = wx.BoxSizer(wx.HORIZONTAL)

l4 = wx.StaticText(panel, -1, “Read only text”)

        hbox4.Add(l4, 1,

wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

        self.t4 = wx.TextCtrl(panel, value = "ReadOnly

Text",style = wx.TE_READONLY|wx.TE_CENTER)

hbox4.Add(self.t4,1,wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

vbox.Add(hbox4)

panel.SetSizer(vbox)

self.Centre()

self.Show()

self.Fit()

def OnKeyTyped(self, event):

print event.GetString()

def OnEnterPressed(self,event):

print “Enter pressed”

def OnMaxLen(self,event):

print “Maximum length reached”

app = wx.App()

Mywin(None, ‘TextCtrl demo’)

app.MainLoop()

On Tue, Jan 17, 2017 at 9:12 AM, swestin@grammatech.com
wrote:

          I'm working on an application that needs to

support multiple platforms. It uses a simple wx.TextCtrl
to get user input, which works fine when the code runs on
Windows 7 using the native backend. But running on a Linux
host (Ubuntu 3.8.0) with the display on my Windows box
using the CygWin X11 server, the numeric keypad does
nothing. And yes, “Num Lock” is on in both cases.

          At this point, I'm even having trouble getting key events

from the control. I get the EVT_TEXT_ENTER event just
fine, but nothing gets called on EVT_CHAR, EVT_KEY_UP, and
EVT_KEY_DOWN, even for keys on the main keyboard. On
Windows, all events arrive as expected.

          Any hints as to what I'm doing wrong?



          - Stephen
            --

            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 wxpython-users+unsubscribe@googlegroups.com.

            For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

  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 wxpython-users+unsubscribe@googlegroups.com.

  For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

The code I provided does not work? It does not capture the numeric keypad? I have four different versions of Linux, windows 7,8,and 10 and a Mac with 10.x and on those OS’s the code I provided works just fine with the numeric keyboard. In this case I would suggest that you review the differences between your code and the demo code.

···

On Wed, Jan 18, 2017 at 1:06 PM, David Woods transana@gmail.com wrote:

  You might try capturing EVT_KEY_DOWN.  I seem to recall

EVT_KEY_DOWN working differently than EVT_CHAR, and there are key
codes for the Numpad keys, so you can detect their press whether
NUMLOCK is pressed or not. See
https://wxpython.org/docs/api/wx.KeyEvent-class.html for more
detail.

David

  On 01/18/2017 10:32 AM, John Fabiani

wrote:

Add a Panel;
import wx

class Mywin(wx.Frame):

def init(self, parent, title):

        super(Mywin, self).__init__(parent, title =

title,size = (350,250))

panel = wx.Panel(self)

vbox = wx.BoxSizer(wx.VERTICAL)

hbox1 = wx.BoxSizer(wx.HORIZONTAL)

l1 = wx.StaticText(panel, -1, “Text Field”)

        hbox1.Add(l1, 1,

wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

self.t1 = wx.TextCtrl(panel)

hbox1.Add(self.t1,1,wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

self.t1.Bind(wx.EVT_TEXT,self.OnKeyTyped)

vbox.Add(hbox1)

hbox2 = wx.BoxSizer(wx.HORIZONTAL)

l2 = wx.StaticText(panel, -1, “password field”)

hbox2.Add(l2, 1, wx.ALIGN_LEFT|wx.ALL,5)

        self.t2 = wx.TextCtrl(panel,style =

wx.TE_PASSWORD)

self.t2.SetMaxLength(5)

hbox2.Add(self.t2,1,wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

vbox.Add(hbox2)

self.t2.Bind(wx.EVT_TEXT_MAXLEN,self.OnMaxLen)

hbox3 = wx.BoxSizer(wx.HORIZONTAL)

l3 = wx.StaticText(panel, -1, “Multiline Text”)

        hbox3.Add(l3,1,

wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

        self.t3 = wx.TextCtrl(panel,size =

(200,100),style = wx.TE_MULTILINE)

hbox3.Add(self.t3,1,wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

vbox.Add(hbox3)

self.t3.Bind(wx.EVT_TEXT_ENTER,self.OnEnterPressed)

hbox4 = wx.BoxSizer(wx.HORIZONTAL)

l4 = wx.StaticText(panel, -1, “Read only text”)

        hbox4.Add(l4, 1,

wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

        self.t4 = wx.TextCtrl(panel, value = "ReadOnly

Text",style = wx.TE_READONLY|wx.TE_CENTER)

hbox4.Add(self.t4,1,wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

vbox.Add(hbox4)

panel.SetSizer(vbox)

self.Centre()

self.Show()

self.Fit()

def OnKeyTyped(self, event):

print event.GetString()

def OnEnterPressed(self,event):

print “Enter pressed”

def OnMaxLen(self,event):

print “Maximum length reached”

app = wx.App()

Mywin(None, ‘TextCtrl demo’)

app.MainLoop()

  --

  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 wxpython-users+unsubscribe@googlegroups.com.

  For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

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 wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

On Tue, Jan 17, 2017 at 9:12 AM, swestin@grammatech.com
wrote:

          I'm working on an application that needs to

support multiple platforms. It uses a simple wx.TextCtrl
to get user input, which works fine when the code runs on
Windows 7 using the native backend. But running on a Linux
host (Ubuntu 3.8.0) with the display on my Windows box
using the CygWin X11 server, the numeric keypad does
nothing. And yes, “Num Lock” is on in both cases.

          At this point, I'm even having trouble getting key events

from the control. I get the EVT_TEXT_ENTER event just
fine, but nothing gets called on EVT_CHAR, EVT_KEY_UP, and
EVT_KEY_DOWN, even for keys on the main keyboard. On
Windows, all events arrive as expected.

          Any hints as to what I'm doing wrong?



          - Stephen
            --

            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 wxpython-users+unsubscribe@googlegroups.com.

            For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

The code I provided does not work?

No.

It does not capture the numeric keypad?

No. No digits appear in the TextCtrl, and no events are posted, for any key in the numeric keypad.

I have four different versions of Linux, windows 7,8,and 10 and a Mac with 10.x and on those OS’s the code I provided works just fine with the numeric keyboard. In this case I would suggest that you review the differences between your code and the demo code.

Well, if the “demo code” doesn’t work, that doesn’t seem useful.

When I run locally on the Windows machine with native display, I get all the events I expect.

The same code run on Linux, but using the X11 backend with the Cygwin X server (display) on the Windows machine gives no events from the numeric keypad; no digits appear in the TextCtrl.

An xterm running on the Linux machine, using the same display, responds as expected to the numeric keypad (i.e. I can enter digits).

I have double-checked the X keyboard mapping.

I haven’t yet had a chance to try another X server.

···

On Wednesday, January 18, 2017 at 6:08:04 PM UTC-5, johnf wrote:

If the code runs okay locally but not through your X server /
cygwin x setup, I’d look to server/cygwin x as the source of the
problem, or perhaps it’s an interaction between that and
wxPython. I might also look at what key events other wxPython
controls, such as the wx.RichText control, receive.

David

···

On 01/19/2017 11:37 AM,
wrote:

swestin@grammatech.com

    On Wednesday, January 18, 2017 at 6:08:04 PM UTC-5, johnf wrote:

The code I provided does not work?

No.

It does not capture the numeric keypad?

      No. No digits appear in the TextCtrl, and no events are

posted, for any key in the numeric keypad.

        I have four different versions of Linux,

windows 7,8,and 10 and a Mac with 10.x and on those OS’s the
code I provided works just fine with the numeric keyboard.
In this case I would suggest that you review the
differences between your code and the demo code.

      Well, if the "demo code" doesn't work, that doesn't seem

useful.

      When I run locally on the Windows machine with native display,

I get all the events I expect.

      The same code run on Linux, but using the X11 backend with the

Cygwin X server (display) on the Windows machine gives no
events from the numeric keypad; no digits appear in the
TextCtrl.

      An xterm running on the Linux machine, using the same display,

responds as expected to the numeric keypad (i.e. I can enter
digits).

      I have double-checked the X keyboard mapping.



      I haven't yet had a chance to try another X server.

  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 wxpython-users+unsubscribe@googlegroups.com.

  For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
  You might try capturing EVT_KEY_DOWN.  I seem to recall

EVT_KEY_DOWN working differently than EVT_CHAR, and there are key
codes for the Numpad keys, so you can detect their press whether
NUMLOCK is pressed or not. See
https://wxpython.org/docs/api/wx.KeyEvent-class.html for more
detail.

David

I’m afraid that EVT_KEY_DOWN doesn’t work any better than EVT_KEY_UP or EVT_KEY_CHAR.

In fact, I’m not getting per-stroke events (except EVT_TEXT) for any key at all.

I’m currently using SSH tunneling; I wonder if that is a factor.

···

On Wednesday, January 18, 2017 at 4:06:08 PM UTC-5, David wrote:

  On 01/18/2017 10:32 AM, John Fabiani > wrote:

Add a Panel;
import wx

class Mywin(wx.Frame):

def init(self, parent, title):

        super(Mywin, self).__init__(parent, title =

title,size = (350,250))

panel = wx.Panel(self)

vbox = wx.BoxSizer(wx.VERTICAL)

hbox1 = wx.BoxSizer(wx.HORIZONTAL)

l1 = wx.StaticText(panel, -1, “Text Field”)

        hbox1.Add(l1, 1,

wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

self.t1 = wx.TextCtrl(panel)

hbox1.Add(self.t1,1,wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

self.t1.Bind(wx.EVT_TEXT,self.OnKeyTyped)

vbox.Add(hbox1)

hbox2 = wx.BoxSizer(wx.HORIZONTAL)

l2 = wx.StaticText(panel, -1, “password field”)

hbox2.Add(l2, 1, wx.ALIGN_LEFT|wx.ALL,5)

        self.t2 = wx.TextCtrl(panel,style =

wx.TE_PASSWORD)

self.t2.SetMaxLength(5)

hbox2.Add(self.t2,1,wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

vbox.Add(hbox2)

self.t2.Bind(wx.EVT_TEXT_MAXLEN,self.OnMaxLen)

hbox3 = wx.BoxSizer(wx.HORIZONTAL)

l3 = wx.StaticText(panel, -1, “Multiline Text”)

        hbox3.Add(l3,1,

wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

        self.t3 = wx.TextCtrl(panel,size =

(200,100),style = wx.TE_MULTILINE)

hbox3.Add(self.t3,1,wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

vbox.Add(hbox3)

self.t3.Bind(wx.EVT_TEXT_ENTER,self.OnEnterPressed)

hbox4 = wx.BoxSizer(wx.HORIZONTAL)

l4 = wx.StaticText(panel, -1, “Read only text”)

        hbox4.Add(l4, 1,

wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

        self.t4 = wx.TextCtrl(panel, value = "ReadOnly

Text",style = wx.TE_READONLY|wx.TE_CENTER)

hbox4.Add(self.t4,1,wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

vbox.Add(hbox4)

panel.SetSizer(vbox)

self.Centre()

self.Show()

self.Fit()

def OnKeyTyped(self, event):

print event.GetString()

def OnEnterPressed(self,event):

print “Enter pressed”

def OnMaxLen(self,event):

print “Maximum length reached”

app = wx.App()

Mywin(None, ‘TextCtrl demo’)

app.MainLoop()

On Tue, Jan 17, 2017 at 9:12 AM, swe...@grammatech.com > > wrote:

          I'm working on an application that needs to

support multiple platforms. It uses a simple wx.TextCtrl
to get user input, which works fine when the code runs on
Windows 7 using the native backend. But running on a Linux
host (Ubuntu 3.8.0) with the display on my Windows box
using the CygWin X11 server, the numeric keypad does
nothing. And yes, “Num Lock” is on in both cases.

          At this point, I'm even having trouble getting key events

from the control. I get the EVT_TEXT_ENTER event just
fine, but nothing gets called on EVT_CHAR, EVT_KEY_UP, and
EVT_KEY_DOWN, even for keys on the main keyboard. On
Windows, all events arrive as expected.

          Any hints as to what I'm doing wrong?



          - Stephen
            --

            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 wxpython-user...@googlegroups.com.

            For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

  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 wxpython-user...@googlegroups.com.

  For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

I’m currently using SSH tunneling; I wonder if that is a factor.

Maybe you could provide the platform you are using and what versions (sorry if you provided the data in an earlier response - I didn’t notice it) of the software you are using. I can’t ever recall that I ever used ssh tunneling to run a wxPython app. So I too wonder if that has something do with the issue? Using X11 via ssh has always presented problems. Try something like teamview, RDP, or VNC.

···

On Thu, Jan 19, 2017 at 9:44 AM, swestin@grammatech.com wrote:

On Wednesday, January 18, 2017 at 4:06:08 PM UTC-5, David wrote:

  You might try capturing EVT_KEY_DOWN.  I seem to recall

EVT_KEY_DOWN working differently than EVT_CHAR, and there are key
codes for the Numpad keys, so you can detect their press whether
NUMLOCK is pressed or not. See
https://wxpython.org/docs/api/wx.KeyEvent-class.html for more
detail.

David

I’m afraid that EVT_KEY_DOWN doesn’t work any better than EVT_KEY_UP or EVT_KEY_CHAR.

In fact, I’m not getting per-stroke events (except EVT_TEXT) for any key at all.

I’m currently using SSH tunneling; I wonder if that is a factor.

  On 01/18/2017 10:32 AM, John Fabiani

wrote:

Add a Panel;
import wx

class Mywin(wx.Frame):

def init(self, parent, title):

        super(Mywin, self).__init__(parent, title =

title,size = (350,250))

panel = wx.Panel(self)

vbox = wx.BoxSizer(wx.VERTICAL)

hbox1 = wx.BoxSizer(wx.HORIZONTAL)

l1 = wx.StaticText(panel, -1, “Text Field”)

        hbox1.Add(l1, 1,

wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

self.t1 = wx.TextCtrl(panel)

hbox1.Add(self.t1,1,wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

self.t1.Bind(wx.EVT_TEXT,self.OnKeyTyped)

vbox.Add(hbox1)

hbox2 = wx.BoxSizer(wx.HORIZONTAL)

l2 = wx.StaticText(panel, -1, “password field”)

hbox2.Add(l2, 1, wx.ALIGN_LEFT|wx.ALL,5)

        self.t2 = wx.TextCtrl(panel,style =

wx.TE_PASSWORD)

self.t2.SetMaxLength(5)

hbox2.Add(self.t2,1,wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

vbox.Add(hbox2)

self.t2.Bind(wx.EVT_TEXT_MAXLEN,self.OnMaxLen)

hbox3 = wx.BoxSizer(wx.HORIZONTAL)

l3 = wx.StaticText(panel, -1, “Multiline Text”)

        hbox3.Add(l3,1,

wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

        self.t3 = wx.TextCtrl(panel,size =

(200,100),style = wx.TE_MULTILINE)

hbox3.Add(self.t3,1,wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

vbox.Add(hbox3)

self.t3.Bind(wx.EVT_TEXT_ENTER,self.OnEnterPressed)

hbox4 = wx.BoxSizer(wx.HORIZONTAL)

l4 = wx.StaticText(panel, -1, “Read only text”)

        hbox4.Add(l4, 1,

wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

        self.t4 = wx.TextCtrl(panel, value = "ReadOnly

Text",style = wx.TE_READONLY|wx.TE_CENTER)

hbox4.Add(self.t4,1,wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)

vbox.Add(hbox4)

panel.SetSizer(vbox)

self.Centre()

self.Show()

self.Fit()

def OnKeyTyped(self, event):

print event.GetString()

def OnEnterPressed(self,event):

print “Enter pressed”

def OnMaxLen(self,event):

print “Maximum length reached”

app = wx.App()

Mywin(None, ‘TextCtrl demo’)

app.MainLoop()

On Tue, Jan 17, 2017 at 9:12 AM, swe...@grammatech.com
wrote:

          I'm working on an application that needs to

support multiple platforms. It uses a simple wx.TextCtrl
to get user input, which works fine when the code runs on
Windows 7 using the native backend. But running on a Linux
host (Ubuntu 3.8.0) with the display on my Windows box
using the CygWin X11 server, the numeric keypad does
nothing. And yes, “Num Lock” is on in both cases.

          At this point, I'm even having trouble getting key events

from the control. I get the EVT_TEXT_ENTER event just
fine, but nothing gets called on EVT_CHAR, EVT_KEY_UP, and
EVT_KEY_DOWN, even for keys on the main keyboard. On
Windows, all events arrive as expected.

          Any hints as to what I'm doing wrong?



          - Stephen
            --

            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 wxpython-user...@googlegroups.com.

            For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
  --

  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 wxpython-user...@googlegroups.com.

  For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

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 wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Well, tunneling doesn’t change anything. I also tried with Xserve on a Macintosh and observed the same behavior.

The leading hypothesis at the moment is that most folks use the GTK backend and the naked X11 backend might have a bug.

Next thing to try: single-stepping through wxWidgets after a keystroke.

I am using

  • wxWidgets 3.0.2
  • wxPython 3.0.2
  • Ubuntu Linux 3.8.0-44 x86_64
  • X server version (Cygwin on local Windows machine)
    Welcome to the XWin X Server
    Vendor: The Cygwin/X Project
    Release: 1.14.5.0
    OS: CYGWIN_NT-6.1-WOW64 swestin-w 1.7.27(0.271/5/3) 2013-12-09 11:57 i686
    OS: Windows 7 Service Pack 1 [Windows NT 6.1 build 7601] (WoW64)
    Package: version 1.14.5-1 built 2013-12-30
  • Windows 7, version 6.1.7601
  • Intel Core i7-4770 @ 3.40 GHz (4 cores, 8 with hyperthreading)
  • ATI Radeon HD 5470, driver 8.920.0.0
  • Stephen
···

On Thursday, January 19, 2017 at 1:03:48 PM UTC-5, johnf wrote:

I’m currently using SSH tunneling; I wonder if that is a factor.

Maybe you could provide the platform you are using and what versions (sorry if you provided the data in an earlier response - I didn’t notice it) of the software you are using. I can’t ever recall that I ever used ssh tunneling to run a wxPython app. So I too wonder if that has something do with the issue? Using X11 via ssh has always presented problems. Try something like teamview, RDP, or VNC.

I used RDP, VNC and both work for me. The program is running on the remote computer and running similar versions of python, wxPython. This is beyond my pay grade!

Johnf

···

On Mon, Jan 23, 2017 at 11:36 AM, swestin@grammatech.com wrote:

On Thursday, January 19, 2017 at 1:03:48 PM UTC-5, johnf wrote:

I’m currently using SSH tunneling; I wonder if that is a factor.

Maybe you could provide the platform you are using and what versions (sorry if you provided the data in an earlier response - I didn’t notice it) of the software you are using. I can’t ever recall that I ever used ssh tunneling to run a wxPython app. So I too wonder if that has something do with the issue? Using X11 via ssh has always presented problems. Try something like teamview, RDP, or VNC.

Well, tunneling doesn’t change anything. I also tried with Xserve on a Macintosh and observed the same behavior.

The leading hypothesis at the moment is that most folks use the GTK backend and the naked X11 backend might have a bug.

Next thing to try: single-stepping through wxWidgets after a keystroke.

I am using

  • wxWidgets 3.0.2
  • wxPython 3.0.2
  • Ubuntu Linux 3.8.0-44 x86_64
  • X server version (Cygwin on local Windows machine)
    Welcome to the XWin X Server
    Vendor: The Cygwin/X Project
    Release: 1.14.5.0
    OS: CYGWIN_NT-6.1-WOW64 swestin-w 1.7.27(0.271/5/3) 2013-12-09 11:57 i686
    OS: Windows 7 Service Pack 1 [Windows NT 6.1 build 7601] (WoW64)
    Package: version 1.14.5-1 built 2013-12-30
  • Windows 7, version 6.1.7601
  • Intel Core i7-4770 @ 3.40 GHz (4 cores, 8 with hyperthreading)
  • ATI Radeon HD 5470, driver 8.920.0.0
  • Stephen

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 wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

I used RDP, VNC and both work for me. The program is running on the remote computer and running similar versions of python, wxPython.

Remote display isn’t the only reason to use X in this tool. We need to support this in pure Linux environments, where X is the only way to get a GUI.

This is beyond my pay grade!

Me, too.

-Stephen

···

On Tuesday, January 24, 2017 at 10:33:49 AM UTC-5, johnf wrote: