screen keyboard

Hey,guys!
Could anybody tell me how can use Python + wxpython write an on-
screen keyboard?

Ping wrote:

Hey,guys!
Could anybody tell me how can use Python + wxpython write an on-
screen keyboard?

Well, there's no magic here. I would probably do it by brute force,
creating a window with bunch of buttons, and connect the button handlers
to my keystroke events.

Some of the operating systems already have onscreen keyboards when you
use their touch extensions. What system are you writing for, and what
is the use case?

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Le 24/03/2011 18:03, Tim Roberts a �crit :

Ping wrote:

Hey,guys!
Could anybody tell me how can use Python + wxpython write an on-
screen keyboard?

Well, there's no magic here. I would probably do it by brute force,
creating a window with bunch of buttons, and connect the button handlers
to my keystroke events.

Some of the operating systems already have onscreen keyboards when you
use their touch extensions. What system are you writing for, and what
is the use case?

Hi,

I am going to write a French keyboard too for Linux, because the keyboard on Gnome does not work very well !...

···

--

Hugues JEAN-BAPTISTE (hjb@agorinfo.fr)
AGORINFO S.A.S. (http://www.agorinfo.fr)

Le 24/03/2011 18:03, Tim Roberts a crit :> Ping wrote:
>> Hey,guys!
>> Could anybody tell me how can use Python + wxpython write an on-
>> screen keyboard?
> Well, there's no magic here. I would probably do it by brute force,
> creating a window with bunch of buttons, and connect the button handlers
> to my keystroke events.

> Some of the operating systems already have onscreen keyboards when you
> use their touch extensions. What system are you writing for, and what
> is the use case?

Hi,

I am going to write a French keyboard too for Linux, because the
keyboard on Gnome does not work very well !...

--

Hugues JEAN-BAPTISTE (h...@agorinfo.fr)
AGORINFO S.A.S. (http://www.agorinfo.fr)

Thanks for response.

We are a bunch of college students trying to develop a cross-platform application which may assist the the ALS (Amyotrophic Lateral
Sclerosis) patients in using computers. The application include the screen mouse and keyboard. As we are very new to Python and
wxPython, lots of things are there for us to learn.

···

On 3月25日, 下午4時02分, Hugues JEAN-BAPTISTE <h...@agorinfo.fr> wrote:

Thanks for your response, Tim.

We are a bunch of college students trying to develop a cross-platform
application which may assist the the ALS (Amyotrophic Lateral
Sclerosis) patients in using computers. The application include the
screen mouse and keyboard. As we are very new to Python and wxPython,
lots of things are there for us to learn.

···

On 3月25日, 上午1時03分, Tim Roberts <t...@probo.com> wrote:

Ping wrote:
> Hey,guys!
> Could anybody tell me how can use Python + wxpython write an on-
> screen keyboard?

Well, there's no magic here. I would probably do it by brute force,
creating a window with bunch of buttons, and connect the button handlers
to my keystroke events.

Some of the operating systems already have onscreen keyboards when you
use their touch extensions. What system are you writing for, and what
is the use case?

--
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.

Hello,
      Does anyone know if there is any way of controlling the ordering of the buttons in a basic MessageDialog or MessageBox? e.g.

wx.MessageBox("Message", "Title", wx.YES_NO | wx.ICON_QUESTION)

produces a message box with the "No" button on the left, and to be consistent with the rest of my application I would prefer it on the right. I've tinkered with the style and tried wx.OK | wx.CANCEL hoping it would give me the "OK" button on the left, but it doesn't.

Just checking if there's a simple solution without having to write my own class. Cheers.

Duncan

Python 2.6, Ubuntu 9.10, wxPython 2.6.

duncan smith wrote:

Hello,
      Does anyone know if there is any way of controlling the ordering
of the buttons in a basic MessageDialog or MessageBox? e.g.

wx.MessageBox("Message", "Title", wx.YES_NO | wx.ICON_QUESTION)

produces a message box with the "No" button on the left, and to be
consistent with the rest of my application I would prefer it on the
right. I've tinkered with the style and tried wx.OK | wx.CANCEL hoping
it would give me the "OK" button on the left, but it doesn't.

Just checking if there's a simple solution without having to write my
own class.

No, and in general you should not TRY to do so.

In Windows, wx.MessageBox calls the operating system's MessageBox API.
The MessageBox API displays those buttons in an order dictated by the
Microsoft Windows User Interface Guidelines, a book that reflects the
tens of hours of user interface research Microsoft has done over the
years, and which used to be required reading for application
developers. Users expect the buttons to be in the order you see.

Now that you've had the requisite scolding, it's pretty darned easy to
create your own MessageBox class. Or, check the wx.MessageDialog class.

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Or just use the GenericMessageDialog: wx.lib.agw.genericmessagedialog. There’s a little demo of it in this article:

http://www.blog.pythonlibrary.org/2010/07/10/the-dialogs-of-wxpython-part-2-of-2/

···

Mike Driscoll
http://www.blog.pythonlibrary.org

Mike Driscoll wrote:

Or just use the GenericMessageDialog: wx.lib.agw.genericmessagedialog. There's a little demo of it in this article:

The Dialogs of wxPython (Part 2 of 2) - Mouse Vs Python

Thanks, I wasn't aware of that. On Windows I get the button order I was wanting, and that's the platform most of the users will be on. I've changed the sizers on my other dialogs to wx.StdDialogButtonSizer instances to get consistency within each platform, despite my personal preference for 'Yes' to the left of 'No'. Only issue now is figuring out why the buttons aren't centre-justified on XP. Cheers.

Duncan

What problem are you trying to solve with this virtual keyboard?
Can you give use more details?

I might be wrong but I imagine that these details could change the
decisions you make dramatically.
Are you trying to recruit some of the available mobility in patients
to provide greater autonomy?
What kind of mobility? What kind of interface are you planning to use
with the patients?

As for being new to Python and wxPython, I envy you... :slight_smile: you have so
many wonderful things to learn in front of you.
Peter

···

On Tue, Mar 29, 2011 at 6:26 AM, Ping <a22269493@yahoo.com.tw> wrote:

We are a bunch of college students trying to develop a cross-platform
application which may assist the the ALS (Amyotrophic Lateral
Sclerosis) patients in using computers. The application include the
screen mouse and keyboard. As we are very new to Python and wxPython,
lots of things are there for us to learn.

--
There is NO FATE, we are the creators.
blog: http://damoc.ro/

Hello,
      I am trying to produce a ComboBox which allows the user to distinguish between two different groups of items. My initial thought was to use different coloured text, but I'm not sure that's possible. Am I basically limited to a single font / colour / background colour for every item in the list? The user should be able to select one, and only one item, but be able to see which group the item belongs to. Much googling has thrown up very little. Thanks.

Duncan

Hi,

Check out the ComboCtrl or the OwnerDrawnComboBox demos in the wxPython demo. I think one of those will do what you want.

  • Mike

Hello,
      I have a grid where row labels will often be too long for the label width, so I want the user to be able to see the full label by moving the mouse over the labels. The following binding and handler almost do the job. The only issue is that the tooltip stays in the same position whilst I move the mouse over the row labels. If I move the mouse out of the label window and then back the tooltip is positioned (initially) where I would like it (at the mouse position). If I move the mouse quickly over the labels the tooltip does occasionally appear at a new location. It appears that what I could do is to post some command event to force a repositioning when I move the mouse from one label to another. I have tried a number of events, such as leaving the row label window, but no luck so far. I don't want to accidentally hit upon something that works for me (i.e. on Ubuntu), but not for the users (almost certainly Windows). So, probably time to stop simply trying things and ask for some advice. Any ideas? Thanks.

Duncan

self.GetGridRowLabelWindow().Bind(wx.EVT_MOTION,self.onMouseOverRowLabel)

     def onMouseOverRowLabel(self, event):
         x = event.GetX()
         y = event.GetY()
         row = self.YToRow(y)
         win = self.GetGridRowLabelWindow()
         win.SetToolTipString(self.GetRowLabelValue(row))
         event.Skip()

We don't have much (if any) control over how and where tooltips are shown, but perhaps if you set the tooltip to "" first, and then reset it to the new value (perhaps via CallAfter) then it will make a difference. (BTW, you should probably be optimizing your code to only set the tooltip value if the event is happening over a different row than where it was shown the last time, otherwise you are setting the same value many times as the mouse moves over the same cell.)

If that doesn't work then you could always use wx.TipWindow and show a tooltip-like window yourself.

···

On 4/14/11 8:27 AM, duncan smith wrote:

Hello,
I have a grid where row labels will often be too long for the label
width, so I want the user to be able to see the full label by moving the
mouse over the labels. The following binding and handler almost do the
job. The only issue is that the tooltip stays in the same position
whilst I move the mouse over the row labels. If I move the mouse out of
the label window and then back the tooltip is positioned (initially)
where I would like it (at the mouse position). If I move the mouse
quickly over the labels the tooltip does occasionally appear at a new
location. It appears that what I could do is to post some command event
to force a repositioning when I move the mouse from one label to
another. I have tried a number of events, such as leaving the row label
window, but no luck so far. I don't want to accidentally hit upon
something that works for me (i.e. on Ubuntu), but not for the users
(almost certainly Windows). So, probably time to stop simply trying
things and ask for some advice. Any ideas? Thanks.

--
Robin Dunn
Software Craftsman

You might also look at the supertooltip widget in the agw lib. It might be easier to configure.

  • Mike

Mike Driscoll wrote:

You might also look at the supertooltip widget in the agw lib. It might be easier to configure.

- Mike

Thanks. That might be my next port of call. Resetting the tooltip made no difference and a wx.TipWindow was less responsive and caused my application to crash in a fairly unpredictable way (and taking down IDLE without providing a traceback). Possibly my fault, but I haven't really got the time to investigate. Cheers.

Duncan

Hi,
if I understand correctly and you are running the code for a wx app
from within Idle, you are likely to get unpredictable errors anyway,
as wx and tkinter somehow interfere with each other imn such casees.

for emulating (simplyfied) toolstips, I was quite happy with using
wx.PopupWindow with a static text in it; you can check the rough
sample:

http://groups.google.com/group/wxpython-users/msg/39c3de5c8a8923e7

(The most complicated part deals with aui, the usage of PopupWindow
itself is rather straightforward.)

regards,
   vbr

···

2011/4/15 duncan smith <buzzard@contactbox.co.uk>:

Thanks. That might be my next port of call. Resetting the tooltip made no
difference and a wx.TipWindow was less responsive and caused my application
to crash in a fairly unpredictable way (and taking down IDLE without
providing a traceback). Possibly my fault, but I haven't really got the
time to investigate. Cheers.

Duncan

Vlastimil Brom wrote:

Thanks. That might be my next port of call. Resetting the tooltip made no
difference and a wx.TipWindow was less responsive and caused my application
to crash in a fairly unpredictable way (and taking down IDLE without
providing a traceback). Possibly my fault, but I haven't really got the
time to investigate. Cheers.

Duncan

Hi,
if I understand correctly and you are running the code for a wx app
from within Idle, you are likely to get unpredictable errors anyway,
as wx and tkinter somehow interfere with each other imn such casees.

That was just in an attempt to get a traceback. I'm actually using Boa Constructor.

for emulating (simplyfied) toolstips, I was quite happy with using
wx.PopupWindow with a static text in it; you can check the rough
sample:

http://groups.google.com/group/wxpython-users/msg/39c3de5c8a8923e7

Thanks, I'll check it out.

Duncan

···

2011/4/15 duncan smith <buzzard@contactbox.co.uk>:

Hello,
       I have a simple problem (I think) for which I can't find a simple solution. I have two types of item that I want the user to be able to select from a combobox. (This is not the same issue I posted about a couple of months ago.) I'd like to be able to add a separator as I would for a menu. Just checking if there's a reasonably simple way of doing that before I start looking at ComboCtrl and OwnerDrawnComboBox (or more likely, just abandon the idea of separating the items). Cheers.

Duncan

duncan smith wrote:

       I have a simple problem (I think) for which I can't find a simple
solution. I have two types of item that I want the user to be able to
select from a combobox. (This is not the same issue I posted about a
couple of months ago.) I'd like to be able to add a separator as I would
for a menu. Just checking if there's a reasonably simple way of doing
that before I start looking at ComboCtrl and OwnerDrawnComboBox (or more
likely, just abandon the idea of separating the items).

One workable but low-tech solution used by many web sites is to add the
string "----------------" where you want the separator.

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.