Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter as tk
- from random import randint
- def main_func():
- global for_change
- for_change.grid(row=6, column=0)
- try:
- sum = 0
- for i in range(int(t1.get())):
- sum+=randint(int(t2.get()),int(t3.get()))
- for_change.config(text='sum of nubers: %s ' % sum)
- except ValueError:
- for_change.config(text='incorrect input values')
- except:
- for_change.config(text='something went wrong')
- root = tk.Tk()
- root.geometry("500x200")
- root.configure(bg="orange red")
- f = tk.Label(root, text="tornike edilashvili", font=('Arial', 18))
- f.grid(row=0,column=0)
- t1 = tk.Entry(root)
- t2 = tk.Entry(root)
- t3 = tk.Entry(root)
- t1.grid(row=1, column=0)
- t2.grid(row=2, column=0)
- t3.grid(row=3, column=0)
- tk.Button(root,
- text='Count', command=main_func).grid(row=4,
- column=0,
- sticky=tk.W,
- pady=4)
- for_change = tk.Label(root, text="", font=('Arial', 16))
- for_change.grid_forget()
- tk.mainloop()
Add Comment
Please, Sign In to add comment