Wednesday, July 26,2017
So I decide to go thought the coding again and I highlighted some important part while reading though the coding in github will looking though  it. I found somethings that were similar to what I will be type again which would repeat.
def numPadConvert(num2convert):
if num2convert == "KP_Insert":
return "0"
if num2convert == "KP_End":
return "1"
if num2convert == "KP_Down":
return "2"
if num2convert == "KP_Next":
return "3"
if num2convert == "KP_Left":
return "4"
if num2convert == "KP_Begin":
return "5"
if num2convert == "KP_Right":
return "6"
if num2convert == "KP_Home":
return "7"
if num2convert == "KP_Up":
return "8"
if num2convert == "KP_Prior":
return "9"
else:
return num2convert

As you can notice that in the code that its keeps reating if num2convert== "KP_    ": Also  their is a coding for the numbers and the color in the roulette and the even talk about the camera . The numbers determine what color it is.
def numColor(numStr):
if numStr in ("1","3","5","7","9","12","14","16","18","19","21","23","25","27","30","32","34","36"):
return "red"
if numStr in ("0","00"):
return "green"
else:
return "black"


Then this is the coding in which they the camera would watch the roulette.


def enter_num(event):
camera.capture("wheel2.jpg")
img2 = ImageTk.PhotoImage(Image.open("wheel2.jpg"))
panel.configure(image=img2)
panel.image=img2
numentered = v.get()
myFont = tkFont.Font(family="Helvetica",size=80,weight="bold")

I also notice that in the when they finished coding their are some code that I repeated from the beginning.
v = StringVar()
camera=picamera.PiCamera()
camera.resolution = (640, 480)
camera.iso=800
camera.exposure_mode = 'sports'
camera.capture("wheel.jpg")
entry_box = Entry(master, textvariable=v, width=5)
entry_box.place(rely=0.0, relx=0.0, x=0,y=0, anchor=NW)
entry_box.focus_set()
entry_box.bind('<Return>',enter_num)
wheelpic = ImageTk.PhotoImage(Image.open("wheel.jpg"))
panel = Label(master, image = wheelpic, height=480, width=450)
panel.place(rely=1.0, relx=1.0, x=0, y=0, anchor=SE)
win.pack()
Then review what Tkinter was and what it can do In:  https://www.tutorialspoint.com/python/python_gui_programming.htm  For more information about Tkinter look at  https://www.youtube.com/watch?v=-tbWoZSi3L it gives some good tip and they have similar ideas to the coding that they use.



Comments