raw-input

Python cancel raw_input/input via writing to stdin?

 ̄綄美尐妖づ 提交于 2020-12-05 12:27:59
问题 For starters, I'm on python 2.7.5 and Windows x64, my app is targeted at those parameters. I'm in need of a way to cancel a raw_input after a certain amount of time has passed. Currently I have my main thread starting two child threads, one is the timer (threading.Timer) and the other fires the raw_input. These both return a value to a Queue.queue that the main thread monitors. It then acts on what is sent to the queue. # snip... q = Queue.queue() # spawn user thread user = threading.Thread

How do I get realtime keyboard input in Python?

こ雲淡風輕ζ 提交于 2020-01-21 12:14:06
问题 Is this possible? Every answer I have looked at isn't what I want. What I do though is something like in omega-rpg (which is an awesome little text-based debian rpg), but in Python instead of C. I have poked around and found some things, but nothing that's relevant to what I'm doing. Is it just easier to use raw_input() / input , or would it be more efficient to use some kind of API for doing so? TO CLEAR UP: I need a system of realtime keyboard input in Python, but I don't know whether it's

Backwards-compatible input calls in Python

泪湿孤枕 提交于 2020-01-09 03:44:12
问题 I was wondering if anyone has suggestions for writing a backwards-compatible input() call for retrieving a filepath? In Python 2.x, raw_input worked fine for input like /path/to/file. Using input works fine in this case for 3.x, but complains in 2.x because of the eval behavior. One solution is to check the version of Python and, based on the version, map either input or raw_input to a new function: if sys.version_info[0] >= 3: get_input = input else: get_input = raw_input I'm sure there is a

Raw_input inside a Python process

我与影子孤独终老i 提交于 2020-01-05 18:08:29
问题 I have created a small script in python where I want to execute two function on the same time using multiprocessing. The first function would do a directory recursive search and the second one will display some questions to the user. Although the .txt file is created the question doesn't appear. I have seen this question: Python command line input in a process but as a beginner I did not understand what is the problem and how to solve it. Here's my script: import os import thread import time

How do I update a dictionary value having the user choose the key to update and then the new value, in Python?

孤者浪人 提交于 2020-01-04 02:55:20
问题 I am trying to write a program where my brother and I can enter and edit information from our football game rosters to compare teams and manage players, etc. This is my first 'big' project i've tried. I have a nested dictionary inside a dictionary, I'm able to get the user to create the dictionaries etc. But when i try to have the 'user' (via raw_input) go back to edit them I get stuck. Below i tried to put a simplified version of the code down of what i think is relevant to my error. If I

Trying to install module win32clipboard

六月ゝ 毕业季﹏ 提交于 2020-01-02 05:21:09
问题 I'm new to python and i'm trying to install win32clipboard to be able to use this code: import win32clipboard win32clipboard.OpenClipboard() win32clipboard.SetClipboardText('testing 123') win32clipboard.CloseClipboard() # get clipboard data win32clipboard.OpenClipboard() data = win32clipboard.GetClipboardData() win32clipboard.CloseClipboard() print data raw_input() How do i exactly install the necessary module to be able to do so? I'm using python version 2.72. 回答1: This module is part of

Can you remap keys of a specific keyboard?

大兔子大兔子 提交于 2020-01-01 09:09:10
问题 I've got two keyboards attached to my computer. A normal full-size keyboard and a numeric keypad. I want to "remap" the keys on the numeric keypad, but leave the full keyboard alone. So, when the user presses "5" on the keypad it would get remapped to the "Media Play" key, but if the same "5" was pressed on the keypad of the full keyboard, I'd get a "5". In essence, I want to turn that seperate numeric keypad into a media control device. Unfortunately I'm not sure how to make this work. There