Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_neural_handwritten.py ZZZ
- from Tkinter import *
- root = Tk()
- def paint(event):
- x1, y1 = (event.x - 12), (event.y - 12)
- x2, y2 = (event.x + 12), (event.y + 12)
- canvas.create_oval( x1, y1, x2, y2, fill = "black" )
- def determine(): # ZZZ
- canvas.delete('all')
- top_frame = Frame(root)
- top_frame.pack(side = TOP)
- middle_frame_L = Frame(root)
- middle_frame_L.pack(side = LEFT)
- middle_frame_R = Frame(root)
- middle_frame_R.pack(side = LEFT)
- page_title = Label(top_frame, text = "MNIST Hand-Written Classification", bg = "#adc9f7", font=("Helvetica", 30))
- page_title.pack(side = TOP, fill = X)
- instructions = Label(top_frame, text = " Draw the chart below one digit or a single letter. After that, click on 'Preview' for the Neural Network to determine the input. ", font = ("Helvetica", 15))
- instructions.pack(side = BOTTOM)
- canvas = Canvas(middle_frame_L, width = 200, height = 200, bg = "#8e8e8e")
- canvas.pack()
- determine_button = Button(middle_frame_L, text = "Determine", command = determine)
- determine_button.pack()
- canvas.bind("<B1-Motion>", paint)
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement