Advertisement
here2share

# Tk_neural_handwritten.py ZZZ

Feb 3rd, 2019
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.09 KB | None | 0 0
  1. # Tk_neural_handwritten.py ZZZ
  2.  
  3. from Tkinter import *
  4. root = Tk()
  5.  
  6. def paint(event):
  7.     x1, y1 = (event.x - 12), (event.y - 12)
  8.     x2, y2 = (event.x + 12), (event.y + 12)
  9.     canvas.create_oval( x1, y1, x2, y2, fill = "black" )
  10.  
  11. def determine(): # ZZZ
  12.     canvas.delete('all')
  13.  
  14. top_frame = Frame(root)
  15. top_frame.pack(side = TOP)
  16. middle_frame_L = Frame(root)
  17. middle_frame_L.pack(side = LEFT)
  18. middle_frame_R = Frame(root)
  19. middle_frame_R.pack(side = LEFT)
  20.  
  21. page_title = Label(top_frame, text = "MNIST Hand-Written Classification", bg = "#adc9f7", font=("Helvetica", 30))
  22. page_title.pack(side = TOP, fill = X)
  23.  
  24. 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))
  25. instructions.pack(side = BOTTOM)
  26.  
  27. canvas = Canvas(middle_frame_L, width = 200, height = 200, bg = "#8e8e8e")
  28. canvas.pack()
  29.  
  30. determine_button = Button(middle_frame_L, text = "Determine", command = determine)
  31. determine_button.pack()
  32.  
  33. canvas.bind("<B1-Motion>", paint)
  34.  
  35. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement