directpython-general Mailing List for DirectPython
Status: Inactive
Brought to you by:
hsalo
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
(2) |
Apr
(2) |
May
(3) |
Jun
(2) |
Jul
(5) |
Aug
(3) |
Sep
|
Oct
(2) |
Nov
|
Dec
(9) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(2) |
Feb
(7) |
Mar
|
Apr
(2) |
May
|
Jun
(1) |
Jul
(5) |
Aug
(11) |
Sep
|
Oct
(3) |
Nov
(7) |
Dec
(5) |
2008 |
Jan
(4) |
Feb
|
Mar
|
Apr
(1) |
May
(3) |
Jun
|
Jul
(2) |
Aug
(1) |
Sep
(2) |
Oct
|
Nov
(4) |
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
|
|
|
1
(1) |
2
|
3
|
4
|
5
|
6
|
7
|
8
|
9
|
10
|
11
|
12
|
13
|
14
|
15
|
16
|
17
|
18
|
19
(1) |
20
(1) |
21
|
22
|
23
|
24
|
25
(1) |
26
|
27
(1) |
28
|
29
|
30
|
31
|
|
|
|
|
|
From: Heikki S. <ho...@gm...> - 2007-12-27 19:49:54
|
_____ From: dir...@li... [mailto:dir...@li...] On Behalf Of ?? Sent: 25. joulukuuta 2007 13:44 To: dir...@li... Subject: [DirectPython] sampleTk.py Dear Sirs, Modified program of tk.py is attached. It works on my notePC. BR, sugi Great work. I always tought that it was somethings simple. The solution was easy when I saw your code: width and height for d3d.createDevice() must not be zero. wxPython sample behaves little differently (zero arguments are correctly fixed), so the issue was not that obvious, especially when it was buried deep in C++ code. But it works now. -- Heikki Salo |
From: <su...@li...> - 2007-12-25 11:44:24
|
IyoqKioqK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F9faW5p dF9fKHNlbGYsIG1hc3Rlcj1Ob25lKToNCiAgICAgICAgRnJhbWUuX19pbml0X18oc2VsZiwgbWFz dGVyLCB3aWR0aD0yMDAsIGhlaWdodD0xMDAsIGJnPSJncmVlbiIpDQogICAgICAgIHNlbGYucGFj aygpDQogICAgICAgIHNlbGYuY3JlYXRlV2lkZ2V0cygpDQoNCmlmIF9fbmFtZV9fID09ICJfX21h aW5fXyI6DQogICAgYXBwID0gQXBwbGljYXRpb24oKQ0KICAgIGFwcC5tYWlubG9vcCgpDQoNCg== |
From: Heikki S. <ho...@gm...> - 2007-12-20 14:24:55
|
_____ From: dir...@li... [mailto:dir...@li...] On Behalf Of Alec Bennett Sent: 19. joulukuuta 2007 10:08 To: dir...@li... Subject: [DirectPython] directinput and MAME? I'm trying to send keystrokes from Python to MAME. In case anyone's interested and doesn't know, MAME is an emulator to play classic arcade games (mamedev.org). I'm sending keystrokes from Python on Win32 like this: import win32api import win32com.client shell=win32com.client.Dispatch("WScript.Shell") shell.SendKeys("1") This works in everything but MAME which, as I've just learned, uses DirectInput. Can anyone think of a way to send keystrokes under this environment? I know it's possible, since there's a program called joykeys (http://members.aol.com/bretjohn/ <http://members.aol.com/bretjohn/> ) that translates joystick motion to keystrokes and works in Mame. Thanks for any help. Hi, You should be able to send keyboard events with win32api.keybd_event() ( http://msdn2.microsoft.com/en-us/library/ms646304.aspx ). These should work with applications using DirectInput for keyboard events too (at least with more recent OS versions, I think DirectInput used some more direct approach in older systems but I am not 100% sure about it). Just remeber that only the focus window will receive these events. Also note that SendInput() has superseded this function, but keybd_event() still works and is somewhat easier to use. -- Heikki Salo |
From: Alec B. <wry...@gm...> - 2007-12-19 08:07:42
|
I'm trying to send keystrokes from Python to MAME. In case anyone's interested and doesn't know, MAME is an emulator to play classic arcade games (mamedev.org). I'm sending keystrokes from Python on Win32 like this: import win32api import win32com.client shell=win32com.client.Dispatch("WScript.Shell") shell.SendKeys("1") This works in everything but MAME which, as I've just learned, uses DirectInput. Can anyone think of a way to send keystrokes under this environment? I know it's possible, since there's a program called joykeys ( http://members.aol.com/bretjohn/) that translates joystick motion to keystrokes and works in Mame. Thanks for any help. |
From: Heikki S. <ho...@gm...> - 2007-12-01 14:37:07
|
> -----Original Message----- > From: Skepsis [mailto:sk...@bl...] > Sent: 30. marraskuuta 2007 22:28 > To: ho...@gm... > Subject: Re: [DirectPython] Sending keys > > Sorry forthe direct mail ... I can not seem to reply tothe > discussion board? > > Thanks for the mail. I will check them out but the problem is > that the normal methods of sending input like win32 send > message / keyboard_event mouse_event even > the neat Sendkeys module, only work for 'normal' windows. > I need to > control game program windows and these are not affected by > the normal methods. > > I have yet to try post message and the sendInput you pointed > me to once I understand it some :) and you are right I dont > know C or C++. > > Thanks again > Adrian > I added the mailing list to receivers, just in case someone else is interested about this. As you have noticed, keyboard_event() and others only work with native Windows controls. Most games don't use them because they usually need some special styles or effects. Games running in fullscreen can't use them even if they wanted (with some minor exceptions). So the usual solution is to implement "windowless" controls. They create custom windows which are specific to the application. Windows (the operating system, that is) does not know anything about them. The d3dgui module which comes with DirectPython is one example. Some normal applications also use windowless controls (like Internet Explorer). So how do they expose themself to the user? Normally they don't have to do much. When a user moves the mouse (or presses a key etc.), the main window receives the event and the application then figures out what widget should receive it. Everything works fine as long as the user is conserned. Problems arise when you need to use these things without normal (mouse and keyboard) methods. For example testing, usability support and in you case voice control are harder with windowless applications. There are several ways in which you can dig information about these controls that are normally invisible to the operating system. These are some common ways in which windowless applications expose their "internals": -Implement Windows Active accessibility API. Implement IAccessible COM-object that provides information about the custom controls. This is a normal way to support screen readers and other accessibility applications. -Implement custom COM/OLE support. Microsoft Office, Internet explorer and some other applications can be controlled programmatically and information can be asked about their contents. -Implement some other accessibility protocol. -No support, use OCR and other methods to dig info about the application. -No support, you must reverse engineer the data structures used by the program. This is difficult and dangerous, but sometimes there are no alternatives if you have to do it. If you only need to support windowless applications created using Python and they use open-source windowless GUI-libraries, there is another way. It might sound weird or difficult, but it should usually work quite well. Not for the faint of heart, though! It also requires some C-experience, altough it is be possible to write dll's with other langueages. Suppose you want to get information about the process A, which uses d3dgui-library (or it can use some pygame GUI, it does not matter much) for it's controls. No normal method works, so you have to get creative. Your voice control application is process B. Create a very basic .dll which is then injected into procees A. The dll uses Python C-API to find the module d3dgui and overrides (for example) Manager.render() class method or adds a property which just monitors the custom controls and notifies process B about the existing controls (like position and text). Different GUI-libraries require different approaches, but the principle is same. You can also use a debugger to figure out how the application works internally. You could also try to modify the application before it starts (especially if it is done by py2exe or some similar method), but it can cause some problems. However, that could be easier than doing it on the fly. Without knowing more accurately what your application does, I can't give much more hints. It's up to you to decide what you need are how much work are you willing to do for it. -- Heikki Salo |