Python Forum

Full Version: Generate ctrl-A behaviour
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a listctrl. ctrl-a selects all items, ctrl-c copies them to the clipboard (in the usual way).
I want to add a single button to my wxpython gui to do both operations but can find no information.
Can anyone help please?
https://wxpython.org/Phoenix/docs/html/w...#wx.Button
you should also download the demo (you can just get the demo source, or entire package) here: https://github.com/wxWidgets/Phoenix
If you have git installed, you can also clone the source:
git clone https://github.com/wxWidgets/Phoenix
to run demo:
python demo.py
I know how to build a button and a gui!
It's the ctrl-A and ctrl-C behaviour I want to mimic...
You will need to create a keyboard event, triggered by the keyboard scan code for ctrl-A
ctrl-C is special case, as it triggers system abort command, and that will have to be intercepted,

this doc discusses capturing a keystroke event: https://wxpython.org/Phoenix/docs/html/wx.KeyEvent.html

Unfortunately, I have been unable after several tries to load wxpython on OpenSuse, and haven't got around to resolving the issue (hasn't been a priority, and won't be until I need GUI for something) so can't actually test any code.

There was a thread about intercepting ctrl-C recently, may or may not be this one: https://python-forum.io/Thread-Generate-...-behaviour