Guest User

Untitled

a guest
Dec 28th, 2019
126
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from tkinter import *
  2. from tkinter import colorchooser
  3.  
  4. color = 'black'
  5. r = 5
  6.  
  7. def create_brush(event):
  8.     x = event.x  
  9.     y = event.y
  10.     x1 = int(x) + r
  11.     y1 = int(y) + r
  12.     brush = canvas.create_oval(x, y, x1, y1, tag='brush', fill=color, width=0, outline=color)
  13.  
  14. def start_paint():
  15.     global canvas
  16.     canvas = Canvas(window_main, width=1440, height=900)
  17.     canvas.pack()
  18.     canvas.bind('<B1-Motion>', create_brush)
  19.  
  20.  
  21. def get_color():
  22.     global color
  23.     color = colorchooser.askcolor()[1]
  24.  
  25.  
  26. def new_list():
  27.     canvas.delete(ALL)
  28.  
  29. def weight_line():
  30.     global r
  31.     r = 20
  32.  
  33. def main():
  34.     global window_main
  35.     window_main = Tk()
  36.     window_main.attributes('-fullscreen', True)
  37.     start_paint()
  38.     button_quit = Button(window_main, width=12, height=2, text='Выход', bg='red', fg='black', command = lambda: window_main.destroy())
  39.     button_quit.place(x=0, y=0)
  40.     button_weight = Button(window_main, width=12, height=2, text='Толщина Кисти', bg='red', fg='black', command=weight_line)
  41.     button_weight.place(x=94, y=0)
  42.     button_color = Button(window_main, width=12,height=2, text='Цвет', bg='red', fg='black', command=get_color)
  43.     button_color.place(x=188, y=0)
  44.     button_newlist = Button(window_main, width=12,height=2, text='Новый лист', bg='red', fg='black', command=new_list)
  45.     button_newlist.place(x=282, y=0)
  46.     window_main.mainloop()
  47.  
  48.  
  49. if __name__ == '__main__':
  50.     main()
RAW Paste Data