Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.061 X-Spam-Evidence: '*H*': 0.88; '*S*': 0.00; 'python,': 0.02; 'installed.': 0.05; 'seemed': 0.07; 'confuse': 0.09; 'module)': 0.09; 'scripting': 0.09; 'suggestions.': 0.09; 'python': 0.11; 'curses': 0.16; 'giu': 0.16; 'i.e.,': 0.16; 'return,': 0.16; 'set- up': 0.16; 'wrote:': 0.16; 'beginner': 0.18; 'language': 0.19; 'windows': 0.20; 'planet': 0.22; 'am,': 0.23; 'help.': 0.23; 'module': 0.23; 'elements': 0.23; 'errors': 0.23; 'nearly': 0.23; 'header:In-Reply-To:1': 0.24; 'install': 0.25; 'header:User- Agent:1': 0.26; 'installed': 0.26; 'connected': 0.27; 'not,': 0.27; 'not.': 0.27; 'url:moin': 0.27; "doesn't": 0.28; 'device': 0.29; 'interface': 0.29; 'other,': 0.29; 'url:wiki': 0.30; 'window': 0.31; 'anyone': 0.32; 'framework': 0.32; 'point': 0.33; 'url:python': 0.33; 'third': 0.33; 'interface,': 0.33; 'to:addr :python-list': 0.35; 'propose': 0.35; 'question,': 0.35; 'knowledge': 0.35; 'something': 0.35; 'really': 0.35; 'but': 0.36; 'url:org': 0.36; 'possible': 0.36; 'basic': 0.36; 'guidance': 0.36; 'should': 0.37; 'received:10': 0.37; 'subject:: ': 0.37; 'level': 0.37; 'button': 0.38; 'thank': 0.39; 'to:addr:python.org': 0.39; 'seem': 0.39; 'where': 0.40; 'some': 0.40; 'your': 0.60; 'press': 0.61; 'john': 0.61; 'research': 0.62; 'more': 0.62; 'url:%20': 0.63; 'you.': 0.64; 'within': 0.64; 'places': 0.64; 'due': 0.65; 'charset:windows-1252': 0.65; 'url:%1': 0.66; 'dr.': 0.69; 'received:204': 0.75; 'received:10.10': 0.76; 'saw': 0.76; 'institute': 0.77; '(425)': 0.84; '895-4418': 0.84; 'action.': 0.84; 'digipen': 0.84; 'herron': 0.84; 'interaction.': 0.84; 'unclear': 0.84; 'url:guiprogramming': 0.84; 'choice.': 0.93 Date: Wed, 03 Jun 2015 12:15:32 -0700 From: Gary Herron User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Keypress Input References: In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Wed, 03 Jun 2015 21:29:20 +0200 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 58 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1433359762 news.xs4all.nl 2947 [2001:888:2000:d::a6]:45833 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:91987 On 06/03/2015 11:22 AM, John McKenzie wrote: > Hello. > > Very new to Python and looking for some basic help. > > Would like a set-up where something happens when a key is pressed. Not > propose a question, have the user type something, then hit return, then > something happens, but just the R key is pressed, something happens, then > something else happens if the B key is pressed, then a third thing > happens if the G key is pressed. > > My research only served to confuse me. Firstly, I do not understand how > it is possible for this to be a difficult thing not built into the system > for any scripting language made within the last few decades. More to the > point I am unclear on specific suggestions. Most of them seem to be for > Windows only and I want this working on a Raspberry Pi. Saw getch but I > am still confused if it is platform specific or not, or requires a module > to be installed or not. Just get errors if I try to install getch using > PIP. If you are using Python through a CLI (command line interface i.e., a shell), then in fact your request doesn't really make sense. CLIs by their nature don't support that kind of interaction. BUT don't despair. Nearly every GIU framework on the planet has a Python interface, and they all allow for a window to be opened with event processing of your choice. This are some good places to start: https://wiki.python.org/moin/GuiProgramming https://wiki.python.org/moin/GUI%20Programming%20in%20Python Several of these (Tkinter and the curses module) are distributed with Python, so you should already have them installed. Gary Herron > > Other suggestions seemed to be overkill and confused me to due to my > beginner level knowledge and the fact these suggestions have other, more > complicated elements to them. > > I just want a button press on a device connected to a Raspberry Pi to > trigger an action. If anyone can give me some guidance on this I would > appreciate it. > > Thank you. > -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418