Creating a popup message box with an Entry field

前端 未结 3 2184
情深已故
情深已故 2020-12-09 12:05

I want to create a popup message box which prompts user to enter an input. I have this method inside a class. I am basing my code on this guide by java2s.

cl         


        
3条回答
  •  情话喂你
    2020-12-09 12:35

    import tkinter as tk
    from tkinter import simpledialog
    
    ROOT = tk.Tk()
    
    ROOT.withdraw()
    # the input dialog
    USER_INP = simpledialog.askstring(title="Test",
                                      prompt="What's your Name?:")
    
    # check it out
    print("Hello", USER_INP)
    

    Enjoy ...

提交回复
热议问题