Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Keyboard history program
#2
This is a bit late, but if you still need to capture ctrl-c:
here's the general way to capture ctrl-c within a python script.
  • 1st add import signal at top of script.
  • somewhere near the (logical) start of your program, add:
    signal.signal(signal.SIGINT, self.capture_ctrl_c)
  • Add a function:
    def capture_ctrl_c(self, sig, frame):
        print('User interrupt encountered\nAdd your ctrl-C code here')
        ...
Reply


Messages In This Thread
Keyboard history program - by chesschaser - May-06-2020, 09:44 PM
RE: Keyboard history program - by Larz60+ - May-10-2020, 05:25 PM
RE: Keyboard history program - by chesschaser - May-12-2020, 10:24 AM
RE: Keyboard history program - by Larz60+ - May-12-2020, 06:10 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Build a DNS History Rudeus 2 683 Aug-11-2023, 09:52 PM
Last Post: Rudeus
  why is yfinance returning an ellipsis in the middle of ticket history db042190 3 1,035 Jun-12-2023, 06:03 PM
Last Post: db042190
  Coding a logger for firefox history kpiatrou 2 2,939 Dec-25-2018, 06:42 PM
Last Post: snippsat
  How to handle "History" in ptpython sylas 4 4,081 Oct-07-2018, 11:09 PM
Last Post: Larz60+
  How to differentiate displacement-time history muhsin 1 2,849 Feb-14-2018, 11:50 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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