Re: Keypress Input

2015-08-16 Thread John McKenzie
Thanks again to everyone who tried to help. Michael, I especially appreciate your encouragement and chiming in to point out that telling newbies to learn everything there is before posting question was not helpful in getting more people using Python. Have the Pi wired up directly to the but

Re: Keypress Input

2015-07-16 Thread Michael Torrie
On 07/16/2015 01:10 AM, Terry Reedy wrote: > On 7/16/2015 12:30 AM, Michael Torrie wrote: >> On 07/15/2015 07:03 PM, Rick Johnson wrote: >>> >> >> I think you've missed the whole point of the OP's project. He doesn't >> want to make a GUI. He simply wants to have his program do something >> like

Re: Keypress Input

2015-07-16 Thread Michael Torrie
On 07/16/2015 11:22 AM, Rick Johnson wrote: > On Wednesday, July 15, 2015 at 11:30:40 PM UTC-5, Michael Torrie wrote: >> On 07/15/2015 07:03 PM, Rick Johnson wrote: >>> >> >> I think you've missed the whole point of the OP's project. > > Obviously my reply was not only "too much to quote", but

Re: Keypress Input

2015-07-16 Thread Rick Johnson
On Thursday, July 16, 2015 at 1:09:32 AM UTC-5, Terry Reedy wrote: > This really is a nice example. Your rationale for defining an app class > is the best I remember seeing. Well thank you Terry. Your many years of selfless altruistic offerings to this fine group are both inspiring and educatio

Re: Keypress Input

2015-07-16 Thread Rick Johnson
On Wednesday, July 15, 2015 at 11:30:40 PM UTC-5, Michael Torrie wrote: > On 07/15/2015 07:03 PM, Rick Johnson wrote: > > > > I think you've missed the whole point of the OP's project. Obviously my reply was not only "too much to quote", but apparently, and sadly, "too much to read"! I don't k

Re: Keypress Input

2015-07-16 Thread Terry Reedy
On 7/16/2015 12:30 AM, Michael Torrie wrote: On 07/15/2015 07:03 PM, Rick Johnson wrote: I think you've missed the whole point of the OP's project. He doesn't want to make a GUI. He simply wants to have his program do something like blink an LED when someone presses a big red button. He ju

Re: Keypress Input

2015-07-15 Thread Terry Reedy
On 7/15/2015 9:03 PM, Rick Johnson wrote: You may have solved your input capturing problem, and i don't think a GUI is the preferred solution for a graphically deficient device anyhow, but you may well need a GUI in the future, and this would be a fine example from which to learn. This really

Re: Keypress Input

2015-07-15 Thread Michael Torrie
On 07/15/2015 07:03 PM, Rick Johnson wrote: > I think you've missed the whole point of the OP's project. He doesn't want to make a GUI. He simply wants to have his program do something like blink an LED when someone presses a big red button. He just wanted a quick way to test things out since

Re: Keypress Input

2015-07-15 Thread Rick Johnson
On Friday, June 19, 2015 at 12:20:14 AM UTC-5, Christian Gollwitzer wrote: > The nonsense starts here: > > [...snip code...] > > it seems you don't understand event based programming. Duh. No need to abuse the lad. > It waits for the user input and does the dispatching, i.e. > when a key is pr

Re: Keypress Input

2015-07-15 Thread Michael Torrie
On 07/15/2015 01:05 PM, John McKenzie wrote: > Hello, all. > > Thanks to everyone who responded to my post. > > I decided to make sure I had something that worked with what I have now > and used Curses to finish it. However, it turns out that the extra work > and problems with using GPIO pin

Re: Keypress Input

2015-07-15 Thread John McKenzie
Hello, all. Thanks to everyone who responded to my post. I decided to make sure I had something that worked with what I have now and used Curses to finish it. However, it turns out that the extra work and problems with using GPIO pins and wiring up controllers that way is a small amount of

Re: Keypress Input

2015-06-20 Thread Michael Torrie
On 06/20/2015 09:02 AM, John McKenzie wrote: > > Guys, thanks for the various code examples for GPIO and the warning > about debouncing issues. I am still considering going the route of more > complex wiring and doing it a more traditional GPIO way. You can wire up the button without a little

Re: Keypress Input

2015-06-20 Thread John McKenzie
Guys, thanks for the various code examples for GPIO and the warning about debouncing issues. I am still considering going the route of more complex wiring and doing it a more traditional GPIO way. -- https://mail.python.org/mailman/listinfo/python-list

Re: Keypress Input

2015-06-20 Thread John McKenzie
Christian, are you suggesting I learn to do everything perfectly before I ask how to do everything perfectly? Despite your tone and insults I honestly appreciate the response. I know what to focus on and less than 5 minutes from now I will be looking for e- books on the specific subjects you

Re: Keypress Input

2015-06-18 Thread Christian Gollwitzer
Am 15.06.15 um 07:15 schrieb John McKenzie: from Tkinter import * from blinkstick import blinkstick led = blinkstick.find_first() timered = 0 timeyellow = 0 timeblue = 0 colour = None root = Tk() root.title('eFlag 1') def red1(event): colour = 1 def yellow1(event): colour = 2

Re: Keypress Input

2015-06-18 Thread Michael Torrie
On 06/18/2015 01:35 PM, Oscar Benjamin wrote: > I use the following. I found in testing that when you push the button it > prints 'Button pressed' 10 times a second (in actual use it calls poweroff > so I guess bounce isn't an issue there). Is there some reason it needs to > be cleverer in this cas

Re: Keypress Input

2015-06-18 Thread Oscar Benjamin
On Wed, 17 Jun 2015 at 02:23 Michael Torrie wrote: > On 06/16/2015 02:49 PM, Grant Edwards wrote: > > On 2015-06-16, John McKenzie wrote: > > > >> It never occurred to me something so simple as keystrokes would not > >> be present in Python, a language rated as being terrific by everyone > >> I

Re: Keypress Input

2015-06-16 Thread Michael Torrie
On 06/16/2015 02:49 PM, Grant Edwards wrote: > On 2015-06-16, John McKenzie wrote: > >> It never occurred to me something so simple as keystrokes would not >> be present in Python, a language rated as being terrific by everyone >> I know who knows it. > > Ah, but in reality "keystrokes" is not s

Re: Keypress Input

2015-06-16 Thread Paul Rubin
John McKenzie writes: > 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, The quick answer is that you want raw mode tty input.

Re: Keypress Input

2015-06-16 Thread Grant Edwards
On 2015-06-16, John McKenzie wrote: > It never occurred to me something so simple as keystrokes would not > be present in Python, a language rated as being terrific by everyone > I know who knows it. Ah, but in reality "keystrokes" is not simple at all. Keyboards and input handling is a very me

Re: Keypress Input

2015-06-16 Thread John McKenzie
That was the impression I got reading some comments people made online and doing research, so I focused on tkinter. As I mentioned in the 4th sentence of the post you quoted I discovered that was not the case, but by then I had already done some work on the tkinter script so I kept with it.

Re: Keypress Input

2015-06-16 Thread Michael Torrie
On 06/14/2015 11:23 PM, John McKenzie wrote: > Thank to the others who joined in and posted replies. > > Michael, your assumption is correct. To quote my original post, "and I > want this working on a Raspberry Pi." Doing a superficial look at curses > and getch it looks excessively complicate

Re: Keypress Input

2015-06-16 Thread John McKenzie
It appears that one of my posts was cut off. It contains my script but none of the lengthy text in front of it. To summarize, my set-up consists of three "massive arcade buttons" from Adafruit. one red, one blue, one yellow. They are connected to a Kade Device that is connected to a Raspberr

Re: Keypress Input

2015-06-15 Thread Grant Edwards
On 2015-06-15, Oscar Benjamin wrote: > Note that going into raw mode has other implications such as not > being able to exit your program with ctrl-c or suspend with ctrl-z > etc. You can explicitly process those kinds of contrl keys with > something like: > > while True: > key = getch() >

Re: Keypress Input

2015-06-15 Thread Oscar Benjamin
On 15 June 2015 at 06:23, John McKenzie wrote: > > Thank to the others who joined in and posted replies. > > Michael, your assumption is correct. To quote my original post, "and I > want this working on a Raspberry Pi." Doing a superficial look at curses > and getch it looks excessively complica

Re: Keypress Input

2015-06-14 Thread John McKenzie
Thank to the others who joined in and posted replies. Michael, your assumption is correct. To quote my original post, "and I want this working on a Raspberry Pi." Doing a superficial look at curses and getch it looks excessively complicated. I was under the impression it was not multi-platfo

Re: Keypress Input

2015-06-14 Thread John McKenzie
from Tkinter import * from blinkstick import blinkstick led = blinkstick.find_first() timered = 0 timeyellow = 0 timeblue = 0 colour = None root = Tk() root.title('eFlag 1') def red1(event): colour = 1 def yellow1(event): colour = 2 def blue1(event): colour = 3 root.bind_all(

Re: Keypress Input

2015-06-06 Thread Michael Torrie
On 06/06/2015 12:28 PM, John McKenzie wrote: > > Laura and Gary, thank you for your replies. I have three physical > buttons connected to a Kade device emulating a keyboard. These buttons > control an LED light strip. So there is no screen, so a GUI did not cross > my mind. I thought it made s

Re: Keypress Input

2015-06-06 Thread Chris Angelico
On Sun, Jun 7, 2015 at 4:28 AM, John McKenzie wrote: > It turns out Tkinter is installed on Raspian and my Pi has it. Typing > import tkinter into the Python interpreter gave me an error, then I > corrected my spelling. The T should be upper case. No errors with "import > Tkinter". Ah, that mean

Re: Keypress Input

2015-06-06 Thread Laura Creighton
In a message of Sat, 06 Jun 2015 18:28:29 +, John McKenzie writes: > > > Laura and Gary, thank you for your replies. I have three physical >buttons connected to a Kade device emulating a keyboard. These buttons >control an LED light strip. So there is no screen, so a GUI did not cross >my mi

Re: Keypress Input

2015-06-06 Thread John McKenzie
Laura and Gary, thank you for your replies. I have three physical buttons connected to a Kade device emulating a keyboard. These buttons control an LED light strip. So there is no screen, so a GUI did not cross my mind. I thought it made sense as it is easily done by other scripting languages

Re: Keypress Input

2015-06-04 Thread Laura Creighton
In a message of Wed, 03 Jun 2015 20:59:04 +0200, Laura Creighton writes: >Tkinter runs on raspberry pi. > >Get it installed, and then run this program. > >from Tkinter import * >root = Tk() >prompt = 'Press any key. Remember to keep your mouse in the cyan box. ' >lab = Label(root, text=prompt, widt

Re: Keypress Input

2015-06-03 Thread Gary Herron
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 p

Re: Keypress Input

2015-06-03 Thread Gary Herron
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 p

Re: Keypress Input

2015-06-03 Thread Laura Creighton
Tkinter runs on raspberry pi. Get it installed, and then run this program. from Tkinter import * root = Tk() prompt = 'Press any key. Remember to keep your mouse in the cyan box. ' lab = Label(root, text=prompt, width=len(prompt), bg='cyan') lab.pack() def key(event): msg = 'event.char is %r

Keypress Input

2015-06-03 Thread John McKenzie
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