Python Forum
Generate ctrl-A behaviour - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: Generate ctrl-A behaviour (/thread-12418.html)



Generate ctrl-A behaviour - edgarfinchley - Aug-23-2018

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?


RE: Generate ctrl-A behaviour - Larz60+ - Aug-24-2018

https://wxpython.org/Phoenix/docs/html/wx.Button.html#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



RE: Generate ctrl-A behaviour - edgarfinchley - Aug-24-2018

I know how to build a button and a gui!
It's the ctrl-A and ctrl-C behaviour I want to mimic...


RE: Generate ctrl-A behaviour - Larz60+ - Aug-24-2018

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-ctrl-A-behaviour