gui-args-framework


Namegui-args-framework JSON
Version 1.2.4 PyPI version JSON
download
home_page
SummaryA framework to create a GUI for a Python console application.
upload_time2023-06-03 09:22:17
maintainer
docs_urlNone
author
requires_python
licenseFree
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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:

```python
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.
            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "gui-args-framework",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/cc/23/67a57dc159277cb85d6c2dc9e95ae12a67c0f7ffcbe590688a0cee7956de/gui_args_framework-1.2.4.tar.gz",
    "platform": null,
    "description": "# gui-args-framework\n\n**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.\n\nSupposing, 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.\n\nThe example below is to understand how it works. There is a program to calculate sum of two integers:\n\n```python\nfrom gui_args_framework.args_window import ArgsWindow\nfrom gui_args_framework.fields import IntegerField\n\n\nclass TestWindow(ArgsWindow):\n    title = \"Test\"\n    args = [\n        IntegerField(name='x', label='First'),\n        IntegerField(name='y', label='Second'),\n    ]\n    description = \"This program calculates sum of two integer numbers.\"\n\n    def main(self, this):\n        if this.confirm(\"Are you sure?\"):\n            z = this['x'] + this['y']\n            this.message(\"The sum is {}\".format(z))\n\n\nTestWindow.run()\n```\n\n## Installation\n\n    pip install gui-args-framework\n\n## Window parameters\n\nYou can customize your windows with following parameters:\n\n```\ntitle = \"Name of your program\"  # This is required\nargs = []  # List of arguments (see the example adove)\ndescription = \"Some description of your program.\"  # Default is empty\n\nwindow_pos = (100, 100)  # A 2D-tuple that defines (x, y) of the absolute position of the window, default is (100, 100)\ngeom = (400, 400)  # A 2D-tuple that defines width and height of the window, default is (400, 400)\nshowTypes = False  # Show types of the arguments near the names, default is False\ndescriptionLimit = 50  # Maximum length of the line in the description without breaking, default is 50\n```\n\n## This methods of **this**\n\nIn `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.\n\n*this[**name**]* - gets the value of the argument *name*.\n\n*this.**message**(text)* - shows information dialog with text *text*.\n\n*this.**confirm**(prompt)* - shows prompt dialog with text *prompt*, returns True or False depending on user's choice.\n\n## Field arguments\n\n**name** - name of the argument. Required.\n\n**label** - description of the argument (shown in GUI). Required.\n\n**required** - necessity of the argument. Default is `True`.\n\n**default** - default value of the argument. Default is `None`.\n\n**choices** - list allowed values of the argument (for *EnumField*). Default is `None`.\n\n## Fields\n\n**StringField** - string argument.\n\n**IntegerField** - integer argument.\n\n**FloatField** - float argument.\n\n**BooleanField** - boolean argument, represented as a checkbox.\n\n**EnumField** - enum argument, represented as a dropdown list (argument *choices* is required).\n\n**FileOpenField** - argument to choose existing file.\n\n**DirectoryField** - argument to choose existing directory.\n\n**FileSaveField** - argument to choose a new file to save.",
    "bugtrack_url": null,
    "license": "Free",
    "summary": "A framework to create a GUI for a Python console application.",
    "version": "1.2.4",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cc2367a57dc159277cb85d6c2dc9e95ae12a67c0f7ffcbe590688a0cee7956de",
                "md5": "df0a93dbbd867f7a01ebc67152008db2",
                "sha256": "1f20497c6e7882a71c1f7d437b76e56dba9906fd43ba105763bc127c2e411289"
            },
            "downloads": -1,
            "filename": "gui_args_framework-1.2.4.tar.gz",
            "has_sig": false,
            "md5_digest": "df0a93dbbd867f7a01ebc67152008db2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5583,
            "upload_time": "2023-06-03T09:22:17",
            "upload_time_iso_8601": "2023-06-03T09:22:17.349321Z",
            "url": "https://files.pythonhosted.org/packages/cc/23/67a57dc159277cb85d6c2dc9e95ae12a67c0f7ffcbe590688a0cee7956de/gui_args_framework-1.2.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-03 09:22:17",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "gui-args-framework"
}
        
Elapsed time: 0.08764s