GUI Input in a window with Python

How to get a GUI for an input in python in a couple of lines with the module tkinter and simpledialog. Using the askinteger function of this method you can create a window that will return what your input in an entry. Very useful for your guis.

def winput(title, sentence):
    import tkinter as tk
    from tkinter import simpledialog
    tk.Tk().withdraw()
    y = simpledialog.askinteger(title, sentence)
    return y


x = winput("Hello", "How is 5 + 5?")
print(x)

Video


Subscribe to the newsletter for updates
Tkinter templates
My youtube channel

Twitter: @pythonprogrammi - python_pygame

Videos

Speech recognition game

Pygame's Platform Game

Other Pygame's posts