# your code goes here
from tkinter import *
class Appl(Frame):
def __init__(self, master):
super(Appl, self).__init__(master)
self.grid()
self.create_widgets()
def create_widgets(self):
self.one_lbl = Label(self, text = "Делимое")
self.one_lbl.grid(row = 0, column = 0, sticky = W)
self.two_lbl = Label(self, text = "Делитель")
self.two_lbl.grid(row = 0, column = 1, sticky = W)
self.doe_ent = Entry(self)
self.doe_ent.grid(row = 1, column = 0, sticky = W)
self.dtel_ent = Entry(self)
self.dtel_ent.grid(row = 1, column = 1, sticky = W)
self.bttn = Button(self, text = "Result", command = self.logica)
self.bttn.grid(row = 2, column = 0, sticky = W)
self.text = Text(self, width = 100, height = 50, wrap = WORD)
self.text.grid(row = 3, column = 0, columnspan = 3, sticky = W)
def logica(self):
atr_one = self.doe_ent.get()
atr_two = self.dtel_ent.get()
iterat = 0
PER = ("\n")
self.text.delete(0.0, END)
while atr_one != atr_two:
iterat += 1
self.text.insert(0.0, ("ITR=", iterat, atr_one, atr_two))
if atr_one > atr_two:
atr_one = atr_one % atr_two
else:
atr_two = atr_two % atr_one
IyB5b3VyIGNvZGUgZ29lcyBoZXJlCmZyb20gdGtpbnRlciBpbXBvcnQgKgpjbGFzcyBBcHBsKEZyYW1lKToKICAgIGRlZiBfX2luaXRfXyhzZWxmLCBtYXN0ZXIpOgogICAgICAgIHN1cGVyKEFwcGwsIHNlbGYpLl9faW5pdF9fKG1hc3RlcikKICAgICAgICBzZWxmLmdyaWQoKQogICAgICAgIHNlbGYuY3JlYXRlX3dpZGdldHMoKQogICAgZGVmIGNyZWF0ZV93aWRnZXRzKHNlbGYpOgogICAgICAgIHNlbGYub25lX2xibCA9IExhYmVsKHNlbGYsIHRleHQgPSAi0JTQtdC70LjQvNC+0LUiKQogICAgICAgIHNlbGYub25lX2xibC5ncmlkKHJvdyA9IDAsIGNvbHVtbiA9IDAsIHN0aWNreSA9IFcpCiAgICAgICAgc2VsZi50d29fbGJsID0gTGFiZWwoc2VsZiwgdGV4dCA9ICLQlNC10LvQuNGC0LX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