DEV Community

petercour
petercour

Posted on

1

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:

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more