Контрольная работа по "Информатике"
Автор: Erasyl_02 • Апрель 26, 2021 • Контрольная работа • 450 Слов (2 Страниц) • 263 Просмотры
1-есеп
from tkinter import *
def change():
if var.get()==0:
label["bg"] ="red"
elif var.get()==1:
label["bg"] ="green"
tk = Tk()
tk.geometry("400x400")
var = IntVar()
var.set(0)
red = Radiobutton(text="Красный", variable=var, value=0)
green = Radiobutton(text="Зеленый", variable=var, value=1)
button = Button(text="Поменять цвет", command=change)
label = Label(height=40, width=40)
red.pack()
green.pack()
button.pack()
label.pack()
tk.mainloop()
2-ЕСЕП
from tkinter import *
root = Tk()
c = Canvas(root, width=350, height=300, bg='white')
c.pack()
i=10
c.create_polygon(5*i,15*i,15*i,5*i,25*i,15*i,fill='black')
c.create_rectangle(10*i,15*i,20*i,30*i,fill='yellow',outline='green')
root.mainloop()
3-ЕСЕП
from tkinter import *
root = Tk()
c = Canvas(root, width=600, height=600, bg='white')
c.pack()
i=10
c.create_polygon(10*i,30*i,30*i,10*i,50*i,30*i,fill='black')
c.create_rectangle(20*i,30*i,40*i,60*i,fill='yellow',outline='green')
c.create_oval(45*i,5*i,55*i,15*i,fill='yellow')
for j in range(0,200,10):
c.create_line((7.5+j/5)*i,65*i,(12.5+j/5)*i,55*i,fill='green')
root.mainloop()
4-есеп
from tkinter import *
def click1():
s = "Университет Нархоз"
text.insert(1.0, s)
def click2():
text.delete(1.0, END)
window = Tk()
window.title("4")
window.geometry("400x250")
text = Text(width=25, height=5)
text.pack()
frame = Frame()
frame.pack()
btn1 = Button(frame, text = "Вставить", command = click1)
btn1.pack(side=LEFT)
btn2 = Button(frame, text = "Очистить", command = click2)
btn2.pack(side=LEFT)
window.mainloop()
5-есеп
from tkinter import*
def click():
print(i)
window = Tk()
window.title("Моя первая программа")
window.geometry("300x150")
button = Button(window,text='Мени басыныз!', command=click,bg='blue')
button.pack()
...