Results 1 to 4 of 4

Thread: How to grab keyboard command in Python ?

  1. #1
    Join Date
    Apr 2011
    Location
    Chittagong,Bangladesh
    Beans
    149
    Distro
    Ubuntu 14.04 Trusty Tahr

    How to grab keyboard command in Python ?

    How to grab keyboard command in Python 3.x ? I want to grab some keyboard command like ctrl+x , F9 etc in my program

  2. #2
    Join Date
    Jan 2009
    Location
    Pennsylvania
    Beans
    113
    Distro
    Ubuntu 14.10 Utopic Unicorn

    Re: How to grab keyboard command in Python ?

    I'm not sure what you mean.

    If you mean when executing a python program at the command line, e.g.

    Code:
    $python 23
    a sample script would look like:

    Code:
    #!/usr/bin/python
    import sys
    import math
    
    i = float(sys.argv[1])
    i = i/4
    print i
    j = float(4)/7
    print j
    where "sys.argv[1]" is the first argument passed to the command.

    Is that what you mean?

  3. #3
    Join Date
    Apr 2011
    Location
    Chittagong,Bangladesh
    Beans
    149
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: How to grab keyboard command in Python ?

    no, I just want to capture keyboard command like ctrl+x in my program .example: If I press ctrl+x program do some job .

  4. #4
    Join Date
    Jun 2005
    Beans
    81

    Re: How to grab keyboard command in Python ?

    So you want to capture hotkeys? Like say ALT or CTRL+P sort?

    You can check the pykeylogger.

    http://pykeylogger.wiki.sourceforge.net/

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •