Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- import tkinter.messagebox
- def fx():
- global Input
- result = ""
- n = int(Value.get())
- try:
- for i in range(1,11): # Changed Xrange to range
- result += "{} x {} = {}\n".format(i,n,i*n)
- except NameError:
- tkinter.messagebox.showerror("What Happened?", "Something went wrong!")
- return print(result), tkinter.messagebox.showinfo("Result", result)
- App = Tk()
- App.title("Your Program!")
- App.geometry("400x100+200+200")
- App.config(bg="#404040")
- Instruction = Label(App, text = "Enter an Integer: ", bg="#404040", fg="white")
- Instruction.pack(side=TOP)
- Input = IntVar(None)
- Value = Entry(App, textvariable = Input, fg="white",bg="#202020")
- Value.pack()
- Run = Button(App, bg="#202020",width = 20, text = " Do work",fg="white",command = fx)
- Run.pack(side=BOTTOM)
- App.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement