DEV Community 👩‍💻👨‍💻

petercour
petercour

Posted on

GUI input with Python

EasyGUI, an easy-to-use interface for simple GUI interaction, can grab user input easily. It's based on tkinter and you can make quick user interactions with it.

Never heard of EasyGUI? See also: https://dev.to/petercour/easygui-with-python-example-45h5

So you can grab user input quickly with only a few lines of code.

Take a look at this:

#!/usr/bin/python3
import easygui as g

def enterbox(msg,title):
    msg = g.enterbox(msg, title, default='',strip = False,image=None)
    print(msg)

enterbox(msg = 'content',title = 'title')

Then:

want to ask a number?

#!/usr/bin/python3
import easygui as g

def integerbox(msg,title,minNum,maxNum):
    msg = g.integerbox(msg, title,default=0, lowerbound=minNum, upperbound=maxNum, image=None)
    print(msg)

integerbox('content', 'title',0,99)

Then:

Resources:

Top comments (0)

Find and follow new tags! 🤔 Did you know?   DEV has a variety of tags to help you find the content you like. Find and follow your favorite tags