Python Forum
Generate ctrl-A behaviour
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Generate ctrl-A behaviour
#1
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?
Reply
#2
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
Reply
#3
I know how to build a button and a gui!
It's the ctrl-A and ctrl-C behaviour I want to mimic...
Reply
#4
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [WxPython] StaticBitmap: unexpected behaviour giu88 0 2,052 Oct-06-2018, 10:09 AM
Last Post: giu88

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020