[wxpython-users] any tips on doing an on-screen keyboard?

C M cmpython at gmail.com
Fri Apr 11 16:50:47 PDT 2008


On Fri, Apr 11, 2008 at 2:43 AM, Alec Bennett <whatyoulookin at yahoo.com> wrote:
> I've been meaning to try an onscreen keyboard in WXPython, wondering if anyone has any tips?
>
>  It only needs to interact with statictext boxes in my wxframe.

I'm unsure what your goals are for this, but are you sure it couldn't
use wxTextCtrls?  (why:  see below)

>  In other words it doesn't need to
>  send keystrokes to external applications or even deal with things like modal dialog boxes.
>
>  I'm guessing the way to go is to make each keyboard button a bitmapbutton, and when clicked it
>  gets the selection point, appends that letter to the selection point, then sets focus back at the
>  selection point? Is that even possible, since when the butotn is clicked that becomes the new
>  selection point? I guess I can keep track of previous selection points in a timer...
>
>  Am I on the right track? Anything you'd do differently?

How could you use a timer for that.  Bitmap buttons are fine.  If you
can, perhaps you could use wxTextCtrl as the output window for your
"typed" text, and if so, you could just mainly use .WriteText() and it
will take care of the insertion points for you, inserting each letter
where you left off or where the user moved the cursor.

>  And since this is a whole lot of bitmap buttons that'd be nice to have moveable, should I put all
>  the buttons on their own panel? Woudl the panel then be moveable and hideable as a unit on my
>  frame? I've never made multiple panels, wondering if that's how it works.

Yes, group the buttons as a "keyboard" on a panel.  You can certainly
move or hide panels in lots of ways:  As Mike said, you can move the
panel if it is either in its own frame or if you use, e.g. the
AUI_DockingWindowMgr (see it in the demo).  Also consider looking at
the Notebook control for "hiding" it in its own tab.


More information about the wxpython-users mailing list