Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- from tkinter import colorchooser
- color = 'black'
- r = 5
- def create_brush(event):
- x = event.x
- y = event.y
- x1 = int(x) + r
- y1 = int(y) + r
- brush = canvas.create_oval(x, y, x1, y1, tag='brush', fill=color, width=0, outline=color)
- def start_paint():
- global canvas
- canvas = Canvas(window_main, width=1440, height=900)
- canvas.pack()
- canvas.bind('<B1-Motion>', create_brush)
- def get_color():
- global color
- color = colorchooser.askcolor()[1]
- def new_list():
- canvas.delete(ALL)
- def weight_line():
- global r
- r = 20
- def main():
- global window_main
- window_main = Tk()
- window_main.attributes('-fullscreen', True)
- start_paint()
- button_quit = Button(window_main, width=12, height=2, text='Выход', bg='red', fg='black', command = lambda: window_main.destroy())
- button_quit.place(x=0, y=0)
- button_weight = Button(window_main, width=12, height=2, text='Толщина Кисти', bg='red', fg='black', command=weight_line)
- button_weight.place(x=94, y=0)
- button_color = Button(window_main, width=12,height=2, text='Цвет', bg='red', fg='black', command=get_color)
- button_color.place(x=188, y=0)
- button_newlist = Button(window_main, width=12,height=2, text='Новый лист', bg='red', fg='black', command=new_list)
- button_newlist.place(x=282, y=0)
- window_main.mainloop()
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement