from tkinter import*
class Rec(Frame):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
k=int(input('Введите количество линий : '))
step = 300//k;
self.master.title("1")
self.pack(fill=BOTH, expand=1)
canvas = Canvas(self, bg="white")
for i in range (0, k+1):
canvas.create_line(0, i*step, 300, 300-i*step)
canvas.pack(fill=BOTH, expand=1)
def main():
root = Tk()
ex = Rec()
root.geometry("300x300")
root.mainloop()
if __name__ == '__main__':
main()
from tkinter import*
class Rec(Frame):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
k=int(input('Введите количество линий : '))
step = 300//k;
self.master.title("1")
self.pack(fill=BOTH, expand=1)
canvas = Canvas(self, bg="white")
for i in range (0, k+1):
canvas.create_line(0, i*step, 300, 300-i*step)
canvas.pack(fill=BOTH, expand=1)
def main():
root = Tk()
ex = Rec()
root.geometry("300x300")
root.mainloop()
if __name__ == '__main__':
main()