Skip to main content

A framework to create a GUI for a Python console application.

Project description

gui-args-framework

gui-args-framework provides a user-friendly way to implement your Python script with GUI easily and quickly, instead of dark ugly terminal window that scares people who are far from programming.

Supposing, you have developed a program that takes arguments, does something and provides a result as text lines. Usually you develop such things as console applications that can be not so convenient to users. With gui-args-framework it can be easily done through GUI.

The example below is to understand how it works. There is a program to calculate sum of two integers:

from gui_args_framework.args_window import ArgsWindow
from gui_args_framework.fields import IntegerField


class TestWindow(ArgsWindow):
    title = "Test"
    args = [
        IntegerField(name='x', label='First'),
        IntegerField(name='y', label='Second'),
    ]
    description = "This program calculates sum of two integer numbers."

    def main(self, this):
        if this.confirm("Are you sure?"):
            z = this['x'] + this['y']
            this.message("The sum is {}".format(z))


TestWindow.run()

Installation

pip install gui-args-framework

Window parameters

You can customize your windows with following parameters:

title = "Name of your program"  # This is required
args = []  # List of arguments (see the example adove)
description = "Some description of your program."  # Default is empty

window_pos = (100, 100)  # A 2D-tuple that defines (x, y) of the absolute position of the window, default is (100, 100)
geom = (400, 400)  # A 2D-tuple that defines width and height of the window, default is (400, 400)
showTypes = False  # Show types of the arguments near the names, default is False
descriptionLimit = 50  # Maximum length of the line in the description without breaking, default is 50

This methods of this

In main function that must be overrriden there is an argument this that contains the values of GUI arguments (by their names) and it has two methods to interact with GUI.

this[name] - gets the value of the argument name.

this.message(text) - shows information dialog with text text.

this.confirm(prompt) - shows prompt dialog with text prompt, returns True or False depending on user's choice.

Field arguments

name - name of the argument. Required.

label - description of the argument (shown in GUI). Required.

required - necessity of the argument. Default is True.

default - default value of the argument. Default is None.

choices - list allowed values of the argument (for EnumField). Default is None.

Fields

StringField - string argument.

IntegerField - integer argument.

FloatField - float argument.

BooleanField - boolean argument, represented as a checkbox.

EnumField - enum argument, represented as a dropdown list (argument choices is required).

FileOpenField - argument to choose existing file.

DirectoryField - argument to choose existing directory.

FileSaveField - argument to choose a new file to save.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gui_args_framework-1.3.0.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gui_args_framework-1.3.0-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file gui_args_framework-1.3.0.tar.gz.

File metadata

  • Download URL: gui_args_framework-1.3.0.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for gui_args_framework-1.3.0.tar.gz
Algorithm Hash digest
SHA256 11ad7901a251a6c7e01de09f35914034d35531d4de046a72ed24851b06981dd6
MD5 72931a92d95386399041b6a3d28c6c9a
BLAKE2b-256 c2af2e7f0408e78198205cbe9f3584ae489ccb6373f36467f19ac30f34abbf53

See more details on using hashes here.

File details

Details for the file gui_args_framework-1.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for gui_args_framework-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dc0d1cee36d64729cfcdc522b26701fefcbabc2c928ec43bdd172be58dbb1fc7
MD5 e75e4985f30435b089ff2bfea1d30be4
BLAKE2b-256 9cd6b6a576d3776dadba2ccde13d2e5a55360e458292be7cc4323da5dabcf117

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page