Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- class Program(Frame):
- def __init__(self, master):
- super(Program, self).__init__(master)
- self.grid()
- self.create_widgets()
- def create_widgets(self):
- self.label1 = Label(self, text = "Enter your name: ")
- self.label1.grid(row = 0, column = 0, sticky = W)
- self.enter_name = Entry(self)
- self.enter_name.grid(row = 0, column = 1, sticky = W)
- self.text_output = Text(self, width = 35, height = 5, wrap = WORD)
- self.text_output.grid(row = 1, column = 0, columnspan = 2, sticky = W)
- self.submit_buttons = Button(self, text = "Submit", command = self.event())
- self.submit_buttons.grid(row = 0, column = 3, sticky = W)
- def event(self):
- name = self.enter_name.get()
- message = name * 10
- self.text_output.insert(0.0, message)
- root = Tk()
- root.title("Name Multiplier")
- root.geometry("300x150")
- program = Program(root)
- program.mainloop()
Add Comment
Please, Sign In to add comment