Python Forum
Simulate Undo keyboard command in code
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simulate Undo keyboard command in code
#3
(May-10-2019, 09:55 PM)Yoriz Wrote: Hi
Your question is very vague

(May-10-2019, 09:31 PM)sgskge1 Wrote: Is there a way in python to simulate a keyboard command within the code.

Within what code ?

Quote:I created an Icon button for Undo. Each time I press the button with a mouse click, I want it to execute the Conrol + Z keyboard press which would represent the Undo command.

What did you use to create a button, where do you want it to execute the Control + Z keyboard

Thank you for your response, and my apologies for not being more specific in the original post.

I added items to an existing context menu using python code for a text editor. The items are Undo and Redo. Each time I select Undo from the context menu, I want it to execute the Undo command. That would be the equivalent of typing 'Control + Z' on the keyboard. My question is there a way to simulate 'Control + Z' command using python code. Right now, I've set it up to print "hello world" each time I select Undo from the context menu. Ultimately, I want it to execute the Undo edit command ('Control + Z') , each time I select Undo from the context menu.

s.
Reply


Messages In This Thread
Simulate Undo keyboard command in code - by sgskge1 - May-10-2019, 09:31 PM
RE: Simulate Undo keyboard command in code - by sgskge1 - May-11-2019, 04:07 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python VS Code: using print command twice but not getting output from terminal kdx264 4 1,159 Jan-16-2023, 07:38 PM
Last Post: Skaperen
  Help Switching between keyboard/Mic input in my code Extra 1 1,131 Aug-28-2022, 10:16 PM
Last Post: deanhystad
  How to use a variable in linux command in python code? ilknurg 2 1,639 Mar-14-2022, 07:21 AM
Last Post: ndc85430
  I need a code line to spam a keyboard key | Image detection bot Aizou 2 3,170 Dec-06-2020, 10:10 PM
Last Post: Aizou
  Undo interation to make a single list? DustinKlent 2 2,219 Nov-29-2020, 03:41 AM
Last Post: DustinKlent
  Help with isinstance command (very simple code) Laplace12 2 2,043 Jul-30-2020, 05:26 AM
Last Post: Laplace12
  What are the available softwares used to edit and simulate network routing protocols? leemao 1 1,960 Dec-25-2019, 05:36 PM
Last Post: Larz60+
  code works at command line but not in .py ridgerunnersjw 4 2,607 Sep-12-2019, 11:09 PM
Last Post: ridgerunnersjw
  Is there any way to simulate clicks/typing to an inactive window using Python? Nwb 1 5,973 Jun-11-2018, 08:56 AM
Last Post: Larz60+
  Trying to simulate different file write speed tbaror 4 4,476 Apr-19-2017, 02:45 PM
Last Post: tbaror

Forum Jump:

User Panel Messages

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