Студия "ПРОГРАММИРОВАНИЕ"
SIRIUS 2 месяца назад #
from tkinter import * import time import threading vy = -1320 st = 0 def move(): global vy, st while True: if st == 1: break vy+=5 label2.place(x=100, y=vy) win.update() vy = -1320 if st == 1: break def start(): global st st=0 t = threading.Thread(target = move) t.start() def stop(): global st st=1 def on_closing(): stop() win.destroy() win = Tk() win.protocol('WM_DELETE_WINDOW', on_closing) win.title('Автомобили') win.geometry('600x600') win.minsize(600,600) button = Button(text = 'Старт', width = 10, command = start) button2 = Button(text = 'Стоп', width = 10, command = stop) label2 = Label(image = imageRoad) label1 = Label(image = imageCar, bg='#666666') label2.place(x=100, y=vy) label1.place(x=350, y=300) win.mainloop()
SIRIUS 2 месяца назад #
from tkinter import * window = Tk() window.title('КНОПКИ') window.geometry('400x400') window.iconbitmap('ikonka.ico') label1 = Label(text='Нажми на кнопку - получишь результат', font = 'Impact, 16') label2 = Label(text='Здесь будет результат', font = 'Impact, 12') button1 = Button(text = 'Нажми меня') window.mainloop()
SIRIUS 3 месяца назад #
PYTHON
Изменение цвета фона формы по нажатию на кнопки
from tkinter import * root = Tk() def color1(col): if col=='g': root.configure(bg='green') if col=='y': root.configure(bg='yellow') if col=='r': root.configure(bg='red') root.geometry ('300x400') root.title('КНОПКИ') root.iconbitmap('ikonka.ico') label1 = Label(text = 'Применение кнопок для изменения цвета формы') button1 = Button(text = 'Зелёный', command = lambda: color1('g')) button2 = Button(text = 'Желтый', command = lambda: color1('y')) button3 = Button(text = 'Красный', command = lambda: color1('r')) root.mainloop()





