Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter as tk
- class getTextWindow():
- def __init__(self,prompt,btnText):
- self.theText = None
- self.display = tk.Tk()
- promptElement = tk.Label(self.display, text=prompt)
- promptElement.pack()
- self.entryBox = tk.Text(self.display)
- self.entryBox.pack()
- button = tk.Button(self.display, text = btnText,command=self.storeText)
- button.pack()
- self.display.mainloop()
- def storeText(self):
- self.theText = self.entryBox.get("1.0", tk.END)
- self.theText = self.theText[:len(self.theText)-1]
- self.display.destroy()
- def getText(self):
- return self.theText
- getCode = getTextWindow('Enter the code:','Confirm')
- playerCode = getCode.getText()
- print(playerCode)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement