Without knowing what you have already tried it is possible that people will simply recommend things that have already caused you difficulty.amerant wrote:okay so i am new to programming python an my knowledge is very limited on the subject currently trying to make buttons and such for a project for the raspberry. but cannot get any of the code i find on tutorials to work??? i am usuing IDLE 3. could someone point me to a good how to website or know a good book?
Code: Select all
from Tkinter import *
import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.OUT)
GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP)
def say_hi():
print "Lighting up LED"
GPIO.output(17, GPIO.HIGH)
time.sleep(5)
GPIO.output(17, GPIO.LOW)
def check_button():
if (GPIO.input(18) == GPIO.LOW):
labelText.set("Button Pressed.")
else:
labelText.set("")
root.after(10,check_button)
root = Tk()
button = Button(root, text="Quit.", fg="red", command=quit)
button.pack(side=RIGHT, padx=10, pady=10, ipadx=10, ipady=10)
hi_there = Button(root, text="Light my LED!", command=say_hi)
hi_there.pack(side=LEFT, padx=10, pady=10, ipadx=10, ipady=10)
labelText = StringVar()
labelText.set("Button Pressed.")
label1 = Label(root, textvariable=labelText, height=4)
label1.pack(side=LEFT)
root.title("LED Blinker")
root.geometry('500x300+200+200')
root.after(10,check_button)
root.mainloop()On the RPi?TrevorAppleton wrote:To make an .exe file so you don't have to use Python you could use py2exe.
I don't have much knowledge I'm python didn't know that was possible. I will do some Looking into it and try and figure her out. Also found a good book on tkinter programming " tkinter gui applications and development" written by hotshot. For anyone who is looking for a book to read up on ittoxibunny wrote:...only problem is, tkinter is UGLY!
Why not make your own gui library with pygame..?
Google knows!amerant wrote:where can I get a list of all the widgets for tkinter that are there for 2.7 python
http://infohost.nmt.edu/tcc/help/pubs/t ... index.htmlamerant wrote:Hey where can I get a list of all the widgets for tkinter that are there for 2.7 python
I 'm in the middle of producing a set of tutorials on this exact topic in my series From Apple to Raspberry Pi which should give you a lot of what you are looking for, including examples. Head over to[ url]http://makeapppie.com/raspberry-pi/[/url] and look at the Tkinter section. I'll be covering stylized buttons and controls this week, and list boxes next week, but to get you some GUI buttons (including graphic ones) for now I think you will be able to get any simple button up and running.amerant wrote:okay so i am new to programming python an my knowledge is very limited on the subject currently trying to make buttons and such for a project for the raspberry. but cannot get any of the code i find on tutorials to work??? i am usuing IDLE 3. could someone point me to a good how to website or know a good book?