Turn (almost) any Python command line program into a full GUI application with one line

Related tags

GUI DevelopmentGooey
Overview

Gooey

Turn (almost) any Python 2 or 3 Console Program into a GUI application with one line

Support this project

Table of Contents


Quick Start

Installation instructions

The easiest way to install Gooey is via pip

pip install Gooey 

Alternatively, you can install Gooey by cloning the project to your local directory

git clone https://github.com/chriskiehl/Gooey.git

run setup.py

python setup.py install

NOTE: Python 2 users must manually install WxPython! Unfortunately, this cannot be done as part of the pip installation and should be manually downloaded from the wxPython website.

Usage

Gooey is attached to your code via a simple decorator on whichever method has your argparse declarations (usually main).

from gooey import Gooey

@Gooey      <--- all it takes! :)
def main():
  parser = ArgumentParser(...)
  # rest of code

Different styling and functionality can be configured by passing arguments into the decorator.

# options
@Gooey(advanced=Boolean,          # toggle whether to show advanced config or not 
       language=language_string,  # Translations configurable via json
       auto_start=True,           # skip config screens all together
       target=executable_cmd,     # Explicitly set the subprocess executable arguments
       program_name='name',       # Defaults to script name
       program_description,       # Defaults to ArgParse Description
       default_size=(610, 530),   # starting size of the GUI
       required_cols=1,           # number of columns in the "Required" section
       optional_cols=2,           # number of columns in the "Optional" section
       dump_build_config=False,   # Dump the JSON Gooey uses to configure itself
       load_build_config=None,    # Loads a JSON Gooey-generated configuration
       monospace_display=False)   # Uses a mono-spaced font in the output screen
)
def main():
  parser = ArgumentParser(...)
  # rest of code

See: How does it Work section for details on each option.

Gooey will do its best to choose sensible widget defaults to display in the GUI. However, if more fine tuning is desired, you can use the drop-in replacement GooeyParser in place of ArgumentParser. This lets you control which widget displays in the GUI. See: GooeyParser

from gooey import Gooey, GooeyParser

@Gooey
def main():
  parser = GooeyParser(description="My Cool GUI Program!") 
  parser.add_argument('Filename', widget="FileChooser")
  parser.add_argument('Date', widget="DateChooser")
  ...

Examples

Gooey downloaded and installed? Great! Wanna see it in action? Head over the the Examples Repository to download a few ready-to-go example scripts. They'll give you a quick tour of all Gooey's various layouts, widgets, and features.

Direct Download

What is it?

Gooey converts your Console Applications into end-user-friendly GUI applications. It lets you focus on building robust, configurable programs in a familiar way, all without having to worry about how it will be presented to and interacted with by your average user.

Why?

Because as much as we love the command prompt, the rest of the world looks at it like an ugly relic from the early '80s. On top of that, more often than not programs need to do more than just one thing, and that means giving options, which previously meant either building a GUI, or trying to explain how to supply arguments to a Console Application. Gooey was made to (hopefully) solve those problems. It makes programs easy to use, and pretty to look at!

Who is this for?

If you're building utilities for yourself, other programmers, or something which produces a result that you want to capture and pipe over to another console application (e.g. *nix philosophy utils), Gooey probably isn't the tool for you. However, if you're building 'run and done,' around-the-office-style scripts, things that shovel bits from point A to point B, or simply something that's targeted at a non-programmer, Gooey is the perfect tool for the job. It lets you build as complex of an application as your heart desires all while getting the GUI side for free.

How does it work?

Gooey is attached to your code via a simple decorator on whichever method has your argparse declarations.

@Gooey
def my_run_func():
  parser = ArgumentParser(...)
  # rest of code

At run-time, it parses your Python script for all references to ArgumentParser. (The older optparse is currently not supported.) These references are then extracted, assigned a component type based on the 'action' they provide, and finally used to assemble the GUI.

Mappings:

Gooey does its best to choose sensible defaults based on the options it finds. Currently, ArgumentParser._actions are mapped to the following WX components.

Parser Action Widget Example
store TextCtrl
store_const CheckBox
store_true CheckBox
store_False CheckBox
version CheckBox
append TextCtrl
count DropDown                 
Mutually Exclusive Group RadioGroup
choice                                              DropDown

GooeyParser

If the above defaults aren't cutting it, you can control the exact widget type by using the drop-in ArgumentParser replacement GooeyParser. This gives you the additional keyword argument widget, to which you can supply the name of the component you want to display. Best part? You don't have to change any of your argparse code to use it. Drop it in, and you're good to go.

Example:

from argparse import ArgumentParser
....

def main(): 
    parser = ArgumentParser(description="My Cool Gooey App!")
    parser.add_argument('filename', help="name of the file to process") 

Given then above, Gooey would select a normal TextField as the widget type like this:

However, by dropping in GooeyParser and supplying a widget name, you can display a much more user friendly FileChooser

from gooey import GooeyParser
....

def main(): 
    parser = GooeyParser(description="My Cool Gooey App!")
    parser.add_argument('filename', help="name of the file to process", widget='FileChooser') 

Custom Widgets:

Widget Example
DirChooser, FileChooser, MultiFileChooser, FileSaver, MultiFileSaver

DateChooser/TimeChooser                                             

Please note that for both of these widgets the values passed to the application will always be in ISO format while localized values may appear in some parts of the GUI depending on end-user settings.

PasswordField

Listbox image
BlockCheckbox image
The default InlineCheck box can look less than ideal if a large help text block is present. BlockCheckbox moves the text block to the normal position and provides a short-form block_label for display next to the control. Use gooey_options.checkbox_label to control the label text
ColourChooser                                             

FilterableDropdown

IntegerField

DecimalField

Slider

Internationalization

Gooey is international ready and easily ported to your host language. Languages are controlled via an argument to the Gooey decorator.

@Gooey(language='russian')
def main(): 
    ... 

All program text is stored externally in json files. So adding new language support is as easy as pasting a few key/value pairs in the gooey/languages/ directory.

Thanks to some awesome contributers, Gooey currently comes pre-stocked with over 18 different translations!

Want to add another one? Submit a pull request!


Global Configuration

Just about everything in Gooey's overall look and feel can be customized by passing arguments to the decorator.

Parameter Summary
encoding Text encoding to use when displaying characters (default: 'utf-8')
use_legacy_titles Rewrites the default argparse group name from "Positional" to "Required". This is primarily for retaining backward compatibility with previous versions of Gooey (which had poor support/awareness of groups and did its own naive bucketing of arguments).
advanced Toggles whether to show the 'full' configuration screen, or a simplified version
auto_start Skips the configuration all together and runs the program immediately
language Tells Gooey which language set to load from the gooey/languages directory.
target Tells Gooey how to re-invoke itself. By default Gooey will find python, but this allows you to specify the program (and arguments if supplied).
suppress_gooey_flag Should be set when using a custom target. Prevent Gooey from injecting additional CLI params
program_name The name displayed in the title bar of the GUI window. If not supplied, the title defaults to the script name pulled from sys.argv[0].
program_description Sets the text displayed in the top panel of the Settings screen. Defaults to the description pulled from ArgumentParser.
default_size Initial size of the window
fullscreen start Gooey in fullscreen mode
required_cols Controls how many columns are in the Required Arguments section
⚠️ Deprecation notice: See Group Parameters for modern layout controls
optional_cols Controls how many columns are in the Optional Arguments section
⚠️ Deprecation notice: See Group Parameters for modern layout controls
dump_build_config Saves a json copy of its build configuration on disk for reuse/editing
load_build_config Loads a json copy of its build configuration from disk
monospace_display Uses a mono-spaced font in the output screen
⚠️ Deprecation notice: See Group Parameters for modern font configuration
image_dir Path to the directory in which Gooey should look for custom images/icons
language_dir Path to the directory in which Gooey should look for custom languages files
disable_stop_button Disable the Stop button when running
show_stop_warning Displays a warning modal before allowing the user to force termination of your program
force_stop_is_error Toggles whether an early termination by the shows the success or error screen
show_success_modal Toggles whether or not to show a summary modal after a successful run
show_failure_modal Toggles whether or not to show a summary modal on failure
show_restart_button Toggles whether or not to show the restart button at the end of execution
run_validators Controls whether or not to have Gooey perform validation before calling your program
poll_external_updates (Experimental!) When True, Gooey will call your code with a gooey-seed-ui CLI argument and use the response to fill out dynamic values in the UI (See: Using Dynamic Values)
use_cmd_args Substitute any command line arguments provided at run time for the default values specified in the Gooey configuration
return_to_config When True, Gooey will return to the configuration settings window upon successful run
progress_regex A text regex used to pattern match runtime progress information. See: Showing Progress for a detailed how-to
progress_expr A python expression applied to any matches found via the progress_regex. See: Showing Progress for a detailed how-to
hide_progress_msg Option to hide textual progress updates which match the progress_regex. See: Showing Progress for a detailed how-to
disable_progress_bar_animation Disable the progress bar
timing_options This contains the options for displaying time remaining and elapsed time, to be used with progress_regex and progress_expr. Elapsed / Remaining Time. Contained as a dictionary with the options show_time_remaining and hide_time_remaining_on_complete. Eg: timing_options={'show_time_remaining':True,'hide_time_remaining_on_complete':True}
show_time_remaining Disable the time remaining text see Elapsed / Remaining Time
hide_time_remaining_on_complete Hide time remaining on complete screen see Elapsed / Remaining Time
requires_shell Controls whether or not the shell argument is used when invoking your program. More info here
navigation Sets the "navigation" style of Gooey's top level window.
Options:
TABBED SIDEBAR
sidebar_title Controls the heading title above the SideBar's navigation pane. Defaults to: "Actions"
show_sidebar Show/Hide the sidebar in when navigation mode == SIDEBAR
body_bg_color HEX value of the main Gooey window
header_bg_color HEX value of the header background
header_height height in pixels of the header
header_show_title Show/Hide the header title
header_show_subtitle Show/Hide the header subtitle
footer_bg_color HEX value of the Footer background
sidebar_bg_color HEX value of the Sidebar's background
terminal_panel_color HEX value of the terminal's panel
terminal_font_color HEX value of the font displayed in Gooey's terminal
terminal_font_family Name of the Font Family to use in the terminal
terminal_font_weight Weight of the font (constants.FONTWEIGHT_NORMAL, constants.FONTWEIGHT_XXX)
terminal_font_size Point size of the font displayed in the terminal
error_color HEX value of the text displayed when a validation error occurs
richtext_controls Switch on/off the console support for terminal control sequences (limited support for font weight and color). Defaults to : False. See docs for additional details
menus Show custom menu groups and items (see: Menus
clear_before_run When true, previous output will be cleared from the terminal when running program again

Layout Customization

You can achieve fairly flexible layouts with Gooey by using a few simple customizations.

At the highest level, you have several overall layout options controllable via various arguments to the Gooey decorator.

show_sidebar=True show_sidebar=False navigation='TABBED' tabbed_groups=True

Grouping Inputs

By default, if you're using Argparse with Gooey, your inputs will be split into two buckets: positional and optional. However, these aren't always the most descriptive groups to present to your user. You can arbitrarily bucket inputs into logic groups and customize the layout of each.

With argparse this is done via add_argument_group()

parser = ArgumentParser()
search_group = parser.add_argument_group(
    "Search Options", 
    "Customize the search options"
)

You can add arguments to the group as normal

search_group.add_argument(
    '--query', 
    help='Base search string'
) 

Which will display them as part of the group within the UI.

Run Modes

Gooey has a handful of presentation modes so you can tailor its layout to your content type and user's level or experience.

Advanced

The default view is the "full" or "advanced" configuration screen. It has two different layouts depending on the type of command line interface it's wrapping. For most applications, the flat layout will be the one to go with, as its layout matches best to the familiar CLI schema of a primary command followed by many options (e.g. Curl, FFMPEG).

On the other side is the Column Layout. This one is best suited for CLIs that have multiple paths or are made up of multiple little tools each with their own arguments and options (think: git). It displays the primary paths along the left column, and their corresponding arguments in the right. This is a great way to package a lot of varied functionality into a single app.

Both views present each action in the Argument Parser as a unique GUI component. It makes it ideal for presenting the program to users which are unfamiliar with command line options and/or Console Programs in general. Help messages are displayed along side each component to make it as clear as possible which each widget does.

Setting the layout style:

Currently, the layouts can't be explicitly specified via a parameter (on the TODO!). The layouts are built depending on whether or not there are subparsers used in your code base. So, if you want to trigger the Column Layout, you'll need to add a subparser to your argparse code.

It can be toggled via the advanced parameter in the Gooey decorator.

@gooey(advanced=True)
def main():
    # rest of code   

Basic

The basic view is best for times when the user is familiar with Console Applications, but you still want to present something a little more polished than a simple terminal. The basic display is accessed by setting the advanced parameter in the gooey decorator to False.

@gooey(advanced=False)
def main():
    # rest of code  


No Config

No Config pretty much does what you'd expect: it doesn't show a configuration screen. It hops right to the display section and begins execution of the host program. This is the one for improving the appearance of little one-off scripts.


Menus

image

Added 1.0.2

You can add a Menu Bar to the top of Gooey with customized menu groups and items.

Menus are specified on the main @Gooey decorator as a list of maps.

@Gooey(menu=[{}, {}, ...])

Each map is made up of two key/value pairs

  1. name - the name for this menu group
  2. items - the individual menu items within this group

You can have as many menu groups as you want. They're passed as a list to the menu argument on the @Gooey decorator.

@Gooey(menu=[{'name': 'File', 'items: []},
             {'name': 'Tools', 'items': []},
             {'name': 'Help', 'items': []}])

Individual menu items in a group are also just maps of key / value pairs. Their exact key set varies based on their type, but two keys will always be present:

  • type - this controls the behavior that will be attached to the menu item as well as the keys it needs specified
  • menuTitle - the name for this MenuItem

Currently, three types of menu options are supported:

  • AboutDialog
  • MessageDialog
  • Link

About Dialog is your run-of-the-mill About Dialog. It displays program information such as name, version, and license info in a standard native AboutBox.

Schema

  • name - (optional)
  • description - (optional)
  • version - (optional)
  • copyright - (optional)
  • license - (optional)
  • website - (optional)
  • developer - (optional)

Example:

{
    'type': 'AboutDialog',
    'menuTitle': 'About',
    'name': 'Gooey Layout Demo',
    'description': 'An example of Gooey\'s layout flexibility',
    'version': '1.2.1',
    'copyright': '2018',
    'website': 'https://github.com/chriskiehl/Gooey',
    'developer': 'http://chriskiehl.com/',
    'license': 'MIT'
}

MessageDialog is a generic informational dialog box. You can display anything from small alerts, to long-form informational text to the user.

Schema:

  • message - (required) the text to display in the body of the modal
  • caption - (optional) the caption in the title bar of the modal

Example:

{
    'type': 'MessageDialog',
    'menuTitle': 'Information',
    'message': 'Hey, here is some cool info for ya!',
    'caption': 'Stuff you should know'
}

Link is for sending the user to an external website. This will spawn their default browser at the URL you specify.

Schema:

  • url - (required) - the fully qualified URL to visit

Example:

{
    'type': 'Link',
    'menuTitle': 'Visit Out Site',
    'url': 'http://www.example.com'
}

A full example:

Two menu groups ("File" and "Help") with four menu items between them.

@Gooey(
    program_name='Advanced Layout Groups',
    menu=[{
        'name': 'File',
        'items': [{
                'type': 'AboutDialog',
                'menuTitle': 'About',
                'name': 'Gooey Layout Demo',
                'description': 'An example of Gooey\'s layout flexibility',
                'version': '1.2.1',
                'copyright': '2018',
                'website': 'https://github.com/chriskiehl/Gooey',
                'developer': 'http://chriskiehl.com/',
                'license': 'MIT'
            }, {
                'type': 'MessageDialog',
                'menuTitle': 'Information',
                'caption': 'My Message',
                'message': 'I am demoing an informational dialog!'
            }, {
                'type': 'Link',
                'menuTitle': 'Visit Our Site',
                'url': 'https://github.com/chriskiehl/Gooey'
            }]
        },{
        'name': 'Help',
        'items': [{
            'type': 'Link',
            'menuTitle': 'Documentation',
            'url': 'https://www.readthedocs.com/foo'
        }]
    }]
)

Input Validation

⚠️ Note! This functionality is experimental. Its API may be changed or removed altogether. Feedback/thoughts on this feature is welcome and encouraged!

Gooey can optionally do some basic pre-flight validation on user input. Internally, it uses these validator functions to check for the presence of required arguments. However, by using GooeyParser, you can extend these functions with your own validation rules. This allows Gooey to show much, much more user friendly feedback before it hands control off to your program.

Writing a validator:

Validators are specified as part of the gooey_options map available to GooeyParser. It's a simple map structure made up of a root key named validator and two internal pairs:

  • test The inner body of the validation test you wish to perform
  • message the error message that should display given a validation failure

e.g.

gooey_options={
    'validator':{
        'test': 'len(user_input) > 3',
        'message': 'some helpful message'
    }
}

The test function

Your test function can be made up of any valid Python expression. It receives the variable user_input as an argument against which to perform its validation. Note that all values coming from Gooey are in the form of a string, so you'll have to cast as needed in order to perform your validation.

Full Code Example

from gooey.python_bindings.gooey_decorator import Gooey
from gooey.python_bindings.gooey_parser import GooeyParser

@Gooey
def main():
    parser = GooeyParser(description='Example validator')
    parser.add_argument(
        'secret',
        metavar='Super Secret Number',
        help='A number specifically between 2 and 14',
        gooey_options={
            'validator': {
                'test': '2 <= int(user_input) <= 14',
                'message': 'Must be between 2 and 14'
            }
        })

    args = parser.parse_args()

    print("Cool! Your secret number is: ", args.secret)

With the validator in place, Gooey can present the error messages next to the relevant input field if any validators fail.


Using Dynamic Values

⚠️ Note! This functionality is experimental. Its API may be changed or removed altogether. Feedback on this feature is welcome and encouraged!

Gooey's Choice style fields (Dropdown, Listbox) can be fed a dynamic set of values at runtime by enabling the poll_external_updates option. This will cause Gooey to request updated values from your program every time the user visits the Configuration page. This can be used to, for instance, show the result of a previous execution on the config screen without requiring that the user restart the program.

How does it work?

At runtime, whenever the user hits the Configuration screen, Gooey will call your program with a single CLI argument: gooey-seed-ui. This is a request to your program for updated values for the UI. In response to this, on stdout, your program should return a JSON string mapping cli-inputs to a list of options.

For example, assuming a setup where you have a dropdown that lists user files:

 ...
 parser.add_argument(
        '--load',
        metavar='Load Previous Save',
        help='Load a Previous save file',
        dest='filename',
        widget='Dropdown',
        choices=list_savefiles(),
    )

Here the input we want to populate is --load. So, in response to the gooey-seed-ui request, you would return a JSON string with --load as the key, and a list of strings that you'd like to display to the user as the value. e.g.

{"--load": ["Filename_1.txt", "filename_2.txt", ..., "filename_n.txt]}

Checkout the full example code in the Examples Repository. Or checkout a larger example in the silly little tool that spawned this feature: SavingOverIt.


Showing Progress

Giving visual progress feedback with Gooey is easy! If you're already displaying textual progress updates, you can tell Gooey to hook into that existing output in order to power its Progress Bar.

For simple cases, output strings which resolve to a numeric representation of the completion percentage (e.g. Progress 83%) can be pattern matched and turned into a progress bar status with a simple regular expression (e.g. @Gooey(progress_regex=r"^progress: (\d+)%$")).

For more complicated outputs, you can pass in a custom evaluation expression (progress_expr) to transform regular expression matches as needed.

Output strings which satisfy the regular expression can be hidden from the console via the hide_progress_msg parameter (e.g. @Gooey(progress_regex=r"^progress: (\d+)%$", hide_progress_msg=True).

Regex and Processing Expression

@Gooey(progress_regex=r"^progress: (?P<current>\d+)/(?P<total>\d+)$",
       progress_expr="current / total * 100")

Program Output:

progress: 1/100
progress: 2/100
progress: 3/100
...

There are lots of options for telling Gooey about progress as your program is running. Checkout the Gooey Examples repository for more detailed usage and examples!

Elapsed / Remaining Time

Gooey also supports tracking elapsed / remaining time when progress is used! This is done in a similar manner to that of the project tqdm. This can be enabled with timing_options, the timing_options argument takes in a dictionary with the keys show_time_remaining and hide_time_remaining_on_complete. The default behavior is True for show_time_remaining and False for hide_time_remaining_on_complete. This will only work when progress_regex and progress_expr are used.

@Gooey(progress_regex=r"^progress: (?P<current>\d+)/(?P<total>\d+)$",
       progress_expr="current / total * 100",
       timing_options = {
        'show_time_remaining':True,
        'hide_time_remaining_on_complete':True,
    })

Elapsed/Remaining Time


Customizing Icons

Gooey comes with a set of six default icons. These can be overridden with your own custom images/icons by telling Gooey to search additional directories when initializing. This is done via the image_dir argument to the Gooey decorator.

@Gooey(program_name='Custom icon demo', image_dir='/path/to/my/image/directory')
def main():
    # rest of program

Images are discovered by Gooey based on their filenames. So, for example, in order to supply a custom configuration icon, simply place an image with the filename config_icon.png in your images directory. These are the filenames which can be overridden:

  • program_icon.png
  • success_icon.png
  • running_icon.png
  • loading_icon.gif
  • config_icon.png
  • error_icon.png

Packaging

Thanks to some awesome contributers, packaging Gooey as an executable is super easy.

The tl;dr pyinstaller version is to drop this build.spec into the root directory of your application. Edit its contents so that the application and name are relevant to your project, then execute pyinstaller build.spec to bundle your app into a ready-to-go executable.

Detailed step by step instructions can be found here.

Screenshots

Flat Layout Column Layout Success Screen Error Screen Warning Dialog
Custom Groups Tabbed Groups Tabbed Navigation Sidebar Navigation Input Validation

Wanna help?

Code, translation, documentation, or graphics? All pull requests are welcome. Just make sure to checkout the contributing guidelines first.

Comments
  • Elapsed / Remaining Time Next to Progress Bar, closes #587

    Elapsed / Remaining Time Next to Progress Bar, closes #587

    Hello!

    This the pull request to go with recently raised https://github.com/chriskiehl/Gooey/issues/587.

    Changes are as follows:

    • New pub/sub event created for application in events.py for TIME_REMAINING_UPDATE.
    • StaticText label added in Footer adjacent to progress bar for displaying elapsed & remaining time.
    • Functions added to processor.py:
      • _get_current_time() either use time.perf_counter() in Python 3.3+ or timeit.default_timer() for Python 2.7 compatibility to get a current time in seconds as a float
      • _calculate_time_remaining(progress,start_time) estimate the time remaining by calculating the current rate of progress over elapsed time and extrapolate for the remainder of progress.
      • format_interval() This was taken from the tqdm project https://github.com/tqdm/tqdm/blob/0cd9448b2bc08125e74538a2aea6af42ee1a7b6f/tqdm/std.py#L228 for showing the elapsed & remaining time in [H]:MM:SS format.
    • _forward_stdout in processor.py has been altered to show time remaining when progress is greater than 0.
    • Relevant tests for all functions added can be found in test_processor.py.

    I absolutely love this package, thank you so much!

    This does not include a dependency of tqdm, as the functionality has been 'extracted'.

    Furthemore, I've created a working example to add to the examples repository as well! Which I have created a PR over at: https://github.com/chriskiehl/GooeyExamples/pull/31.

    fbHcpCAGD8

    Round 2 at pull request!

    opened by JackMcKew 16
  • Terminal window jumps to top on job completion

    Terminal window jumps to top on job completion

    Is it possible to cause Gooey to keep the output window as-is on job completion? I don't want to jump back to the top of the output as what I am really interested in is at the bottom.

    opened by bje- 13
  • Crash after run with latest upgrade

    Crash after run with latest upgrade

    Hi,

    I installed gooey on a new machine. I also experienced the problem with the drop menus for the parameters. After upgrading a few minutes ago this was fix but now I got a crash end the main function ends:

    Pango:ERROR:/build/buildd/pango1.0-1.36.8/./pango/pango-layout.c:3916:pango_layout_check_lines: assertion failed: (!layout->log_attrs)

    The gooey window crashes completly before appearing the edit options. and then the system kills the process completly.

    Any idea?

    Thanks in advance, Sérgio

    opened by sousasag 12
  • Gooey with Click https://github.com/mitsuhiko/click ?

    Gooey with Click https://github.com/mitsuhiko/click ?

    How hard would it be to have Gooey work with Click https://github.com/mitsuhiko/click a popular CLI framework by @mitsuhiko maker of Flask among other super goodies?

    Note that Click uses neither argparse nor optparse but should provide introspection capabilities.

    opened by pombredanne 12
  • [Feature request] Raise exception on Stop Task

    [Feature request] Raise exception on Stop Task

    I'm not sure if this is within the scope of the project, but would it be possible to raise an exception when the Stop button is clicked (much like you would have a KeyboardInterrupt when a user interrupts the program with Ctrl-C) so you can clean up?

    opened by fijam 11
  • WX version compatibility for Gooey, Pip, Conda, and OS platforms

    WX version compatibility for Gooey, Pip, Conda, and OS platforms

    Placeholder for working out how best to structure Gooey's WX dep such that installs across different package managers, platforms, and OSs can all work (mostly) seamlessly, or at least have a useful escape hatch.

    Problems:

    Planned Solution:

    Gooey will loosen its grip on developing against a single known stable WX version, and work with a sliding window starting from 4.1.0 up to current 4.1.1 (and onward as relevant).

    opened by chriskiehl 11
  • Non-ASCII output hangs execution in PyInstaller packaged app

    Non-ASCII output hangs execution in PyInstaller packaged app

    • [Windows 10] OS
    • [3.7.3 ] Python Version
    • [1.0.3] Gooey Version
    • [3.5] PyInstaller

    Hi, I'm having problem with running Gooey app packaged with PyInstaller. App prints some outputs to multi line textbox in "execution screen" but then hangs. App runs with no issues when running it non-packaged. I dug into it and appears the problem is with further printing to multi line box.

    Traceback:

    Exception in thread Thread-1:
    Traceback (most recent call last):
      File "threading.py", line 917, in _bootstrap_inner
      File "threading.py", line 865, in run
      File "lib\site-packages\gooey\gui\processor.py", line 71, in _forward_stdout
      File "lib\site-packages\gooey\gui\processor.py", line 84, in _extract_progress
    UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf1 in position 16: invalid continuation byte
    

    Changing stdout to the following fixed the problem:

    utf8_stdout = os.fdopen(sys.stdout.fileno(), mode='w', encoding='utf-8', closefd=False)
    sys.stdout = utf8_stdout
    

    The issue seems to be related to this closed issue #230

    opened by simplynail 11
  • RFC: Repo cleanup, py2/py3 compatibility

    RFC: Repo cleanup, py2/py3 compatibility

    This PR contains initial work towards a codebase simultaneously compatible with Python 2 and Python 3. Specifically, I used futurize to make the existing py2 codebase py3-compatible. I have split this into separate commits so that thematically separable changes can be reviewed separately.

    Note: If you want to review the changes without whitespace getting in the way, append ?w=1 to the relevant URL on Github to ignore whitespace changes, like this.

    Note: The changes in here also contain the changes from PR #129, as it was easier to include those changes in the line ending normalization.

    To start working with futurize, since I'm on Linux, I first had to normalize the line endings, otherwise all the files showed up as changed. This is because the repo contains CRLF (Windows-style) line endings, and no .gitattributes file to enable cross-platform line-ending compatibility. With the .gitattributes in place, this should now be transparent to all devs, without any special git settings, Windows users get CRLF endings on checkout, all the other get LF. (I already handled such a transition for a bigger project) This work is contained in commit 2216fa2.

    The next set of change is what future calls "stage 1", easy replacements with very low bug potential and no additional dependencies. cb1fc53 dfab1e6

    After those are the autogenerated stage 2 changes, which fix more incompatibilities, but add a dependency on the future package. A small amount of manual fixes, which the futurize heuristics didn't pick up, were also added. 342fe51 d5b9cbe

    FYI: I also have a branch with an initial set of pep8 fixes, but I have not included this here yet since I don't know how you folks feel about pep8. Also, as there is already a commit in here that touches _all the files, we might as well fix the style issues at the same time._

    I know that PR #120 is currently open, and not included in these changes. This is not ideal w.r.t the line ending normalization, but most of the changes in here happened with terminal commands, so it's easily replayable once that PR is merged (if it gets merged).

    All the tests pass, and all the examples that worked before, keep working with those changes. Tested only on py2, since there's no wxpython for py3 yet.

    On a TODO-list for this PR:

    • Fold in the pep8 changes if acceptable
    • (probably) set up a Travis-CI account to get started with at least some automated testing (pytest, plus maybe run some examples?).

    Ping @chriskiehl Relevant issue: #65

    opened by bilderbuchi 11
  • Gooey does not work with Python 3.7 on Windows

    Gooey does not work with Python 3.7 on Windows

    • Windows 10 (Parallels)
    • Python 3.6.7
    • Gooey==1.0.1
    • After Start button host process executes script, child process finishes and dies, but host GUI do not respond in any way, host UI showing like child process still running infinitely.
      • Expected Behavior - show print statements from child process, update UI about finished process.
      • Actual Behavior - nothing is updated, nothing displayed, as if child process still running.
    • Also this incorrect behaviour appears with any program from examples.

    In macOS 10.14 works as expected.

    Here is screenshot showing GUI without updates, on left you can see that child process(in red) died.

    screenshot 2018-10-30 at 00 30 42
    opened by diimdeep 10
  • Unable to take multiple files as input

    Unable to take multiple files as input

    Hi

    I am running on Windows 10, python 3.6.4 64bit, Gooey version 1.0.0

    It seems the recent version of Gooey no longer has the options to accept multiple file inputs. Perhaps it is still under development till further notice.

    When I set the widget as 'MultiFileChooser'

    image

    The code still runs but I can only upload one file

    To resolve this, I change the chooser.py script in \gooey\gui\components\widgets\core

    Around line 68 change

    class MultiFileChooser(Chooser):
        """ Retrieve an multiple files from the system """
        def getDialog(self):
            return wx.FileDialog(self, style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
    

    to

    class MultiFileChooser(Chooser):
        """ Retrieve an multiple files from the system """
        def getDialog(self):
            return wx.FileDialog(self, "Open Files" ,style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST | wx.FD_MULTIPLE)
        def getResult(self, dialog):
            return os.pathsep.join(dialog.GetPaths()) 
    

    This ensures that multiple file paths are separated by semi colon in the input text box.

    Hope this helps.

    Regards, Jeremy

    opened by JauntyJJS 10
  • Features to allow easier use of command line with Gooey

    Features to allow easier use of command line with Gooey

    This pull request incorporates three related changes.

    1. The simplest is really a bug fix. Previously if you used the @Gooey decorator on a function with one or more arguments and called the parser with --ignore-gooey, Python failed with

    TypeError: () takes no arguments (1 given)

    This was fixed by modifying the run_without_gooey function to used an inner2 function like run_gooey does.

    1. The second modification allows the IGNORE_COMMAND argument to be specified as an argument (ignore_command) to the @Gooey decorator (I did this because prefer --no-gui to --ignore-gooey) and adds a further argument (force_command) to be specified. The latter argument reverses the default functionality, so that the script is run without Gooey unless the argument is specified. For example:

    my_command --gui

    1. A slightly more complicated change responds to #200 by adding a boolean argument load_cmd_args to the @Gooey decorator. If this argument is specified then Gooey will parse the arguments from the command line invocation, and use the resulting values as default values (over-riding defaults specified in the Python script) when the GUI is generated. Note that this functionality could be improved by allowing positional arguments to be skipped and not enforcing required when parsing the command line arguments.
    opened by jschultz 10
  • Adding `bengali` language support

    Adding `bengali` language support

    What was changed?

    • Added a bengali.json file under path: gooey/languages/bengali.json

    Bengali is spoken by over 300 million people around the world (ranks 7th by number of speakers). source

    Hello there!

    Make sure you've followed the Contributing guidelines before finalizing your pull request.

    TL;DR:

    • [x] You're opening this PR against the current release branch
    • [ ] Works on both Python 2.7 & Python 3.x
    • [ ] Commits have been squashed and includes the relevant issue number
    • [ ] Pull request description contains link to relevant issue or detailed notes on changes
    • [ ] This must include example code demonstrating your feature or the bug being fixed
    • [ ] All existing tests pass
    • [ ] Your bug fix / feature has associated test coverage
    • [ ] README.md is updated (if relevant)
    opened by sugatoray 1
  • Progress bar time remaining goes missing when progress_regex not a match

    Progress bar time remaining goes missing when progress_regex not a match

    • [x] OS: windows 11 x64
    • [x] Python Version: 3.10.6
    • [x] Gooey Version: 1.2.1-release branch
    • [x] Thorough description of problem
      • [x] Expected Behavior When using progress bar and 'show_time_remaining':True, console lines not matching the progress_regex should be ignored and not affect the time remaining display based on last matching progress update.
      • [x] Actual Behavior Console lines not matching the progress_regex cause the time remaining to disappear until the next matching line.
    • [x] A minimal code example
    • [x] Screenshot (if visual quirk)
    • [x] Anything else you may think will be helpful

    Minimal code example

    from time import sleep
    from gooey import Gooey, GooeyParser
    from itertools import cycle
    
    @Gooey(
        terminal_font_family='Courier New',
        progress_regex=r"^progress: (?P<current>-?\d+)/(?P<total>\d+)$",
        progress_expr="current / total * 100",
        timing_options={
            'show_time_remaining':True,
            'hide_time_remaining_on_complete':False
        })
    def parse_args():
        parser = GooeyParser(prog="example_progress_bar_5")
        parser.add_argument("alpha", type=float, help="Seconds per 10% progress", default=1)
        parser.add_argument("beta", type=int, help="Extra messages between progress updates",default=3)
        parser.add_argument("gamma", type=str, nargs='+', help="List of your messages",
            default=["info ...", "message ...", "warning ..."])
        args = parser.parse_args()
        return args.alpha, args.beta, args.gamma
    
    def main():
        alpha, beta, gamma = parse_args()
        myprocess = cycle(gamma)
    
        print("Step 1")
        for i in range(0, 51, 10):
            sleep(alpha)
            print("progress: {}/{}".format(i,100),flush=True)
    
        print("Step 2")
        for i in range(50, 101, 10):
            sleep(alpha / (beta+1))
            for j in range(beta):
                # some extra text before progress
                print(next(myprocess),flush=True)
                sleep(alpha / (beta+1))
            print("progress: {}/{}".format(i,100),flush=True)
    
    if __name__ == "__main__":
        main()
    

    Screenshots

    |What|Screenshot| |---|---| |Console| Screenshot 2022-12-15 172822 | |Progress bar during step 1 (progress messages only)| Screenshot 2022-12-15 172725 | |Progress bar during step 2 (progress messages and other messages)|Screenshot 2022-12-15 172751|

    Relevant excerpts

    ProcessController

    https://github.com/chriskiehl/Gooey/blob/be4b11b8f27f500e7326711641755ad44576d408/gooey/gui/processor.py#L114-L129

    https://github.com/chriskiehl/Gooey/blob/a451f5265a405951be367217ef8363bf88a46176/gooey/gui/processor.py#L152-L162

    Timing

    https://github.com/chriskiehl/Gooey/blob/a451f5265a405951be367217ef8363bf88a46176/gooey/gui/util/time.py#L19-L25

    Suggested fix

    Update gooey/gui/util/time.py:

    @@ -19,7 +19,7 @@ class Timing(object):
         def _updateEstimate(self, *args, **kwargs):
             prog = kwargs.get('progress')
             if(not prog): 
    -            self.estimatedRemaining = None
    +            # self.estimatedRemaining = None
                 return
             if(prog > 0):
                 self.estimatedRemaining = estimate_time_remaining(prog,self.startTime)
    
    opened by simularis 0
  • Can I use a loop to execute some commands?

    Can I use a loop to execute some commands?

    Thanks for the great work! I need to save some global variables after executing a command and continue to modify this global variable in the next command. It seems that the program exits or re-executes when it finishes executing. Is there a way to make my program LOOP run?

    For example:

    while True:
        args.cmd = input()
        if args.cmd == '1':
            ...
        elif args.cmd == '2':
            ...
        else:
            ...
    

    In other words, how can I share a variable between two independent actions?

    opened by rayrayraykk 0
  • Screen issues

    Screen issues

    Discussed in https://github.com/chriskiehl/Gooey/discussions/858

    Originally posted by Ms-Ajith December 8, 2022 Hello , I would like to point out and ask for problem which I face while using Gooey. Iam attaching the widget_demo.py code in the attachment. The issue I face is whenever minimizing and maximizing the GUI it leaves the mark or make the screen blurry. Why is it so? What should I do for that. Screenshots with the issues is also attached here.

    First screenshot - Whenever drop down list goes below the GUI, it leaves a shadow. Second screenshot - After maximizing the initial cancel start button leaves a shadow. 1 2_1

    Thanks and Regards Gooey.txt

    opened by Ms-Ajith 0
  • When I add a log-in page,it will appear during codes running

    When I add a log-in page,it will appear during codes running

    Hello There, Future Issue Creator!

    • Python Version 3.7.1

    • Gooey Version 1.0.8.1&1.2.0a0

    As for my demands,I want to add some log-in page codes in order to prevent those people who use my app without my permissions, but when I do this, the page will appearagain during my main codes running, instead of just run one time before my main codes running. image

    I have tried many methods to aviod this situation,but it seems everytimes when the codes decorated by gooey are running, my login page which is undecorated would be also runned once again, and I don't know how to solve this problem.

    Part of my codes as follow:

    class Callonce(object):
    
        instance = None
        init_flag = False
    
        def __new__(cls, *args, **kwargs):
    
            if cls.instance is None:
                cls.instance = super().__new__(cls)
            return cls.instance
    
        def __init__(self):
            #my log_in page
    @Gooey(show_preview_warning=False,encoding='utf-8', program_name="fill keeper-V1.0.0", language='english')
    def start():
        parser = GooeyParser()
        parser.add_argument("path", help="choose your file path:", widget="DirChooser") 
        args = parser.parse_args()
        # print(args, flush=True)
        return args
    
    
    if __name__ == '__main__':
        login=Callonce()
        args = start()
        path = args.path
        ......
    
    

    Wish you would give me some advice. Thanks! ^_^

    opened by Wannabeasmartguy 0
  • customize format of MultiFileChooser as list

    customize format of MultiFileChooser as list

    Hi there,

    Thanks a lot for this great tool!

    The multifilechooser is nice and supports drag and drop, but the format does not intuitively indicate that it supports drag and drop.

    Also, it is not practical when dealing with a list of files

    Examples of impractical cases:

    • if the user added several files and wants to double check what they added,
    • add 1 file after another from different directories.
    • Add several files, then maybe remove one of the files.

    Example of a practical list of files

    • You can DnD or use the add which acts like the multifilechooser. And the user can pick an item from the list and click remove image

    Or even something more elaborate with columns, or arrows to select an item and move it up and down in the list image

    is there any way to customize it and enrich it on my side?

    or does really require modification of the core code of Gooey/creating a new widget type? if so, I would really support this feature request with a donation

    Thanks

    opened by mbassiouny33 0
Releases(1.2.0-alpha)
  • 1.2.0-alpha(Feb 4, 2022)

    Gooey 1.2.0-ALPHA Pre-Release!

    Warning:

    Upgrade with caution! 1.2.0 removes the experimental Dynamic Updates feature and replaces it with a new experimental Dynamic Updates feature! The two APIs are incompatible.

    This release brings a whole host of new features to Gooey. Chief among them are the new Dynamic Updates and Validation functionality. This was effectively a rebuild of a substantial portion of Gooey's internal to enable a more client/server style functionality. This means that you have more control over the gooey's lifecycle, and can subscribe to high level events. Currently, FormSubmit, OnComplete, and OnError are supported, but more are on their way! Soon you'll be able to have fine grained control over the UI and its presentation, and still without having to write a single line of traditional GUI code!

    Breaking Changes (1.0.8 -> 1.2.0)

    • Validation - the validation mechanism available via gooey_options has been removed entirely in favor of the new API.
    • Dynamic Updates - there was previously minimal support for loading new data at run time. This has been revomed in favor of a new system which gives advanced control over the state of the UI.

    New Features

    • Dynamic Updates and Validation - Checkout the README for details on how to get started. This feature is really hairy behind the scenes and involves all kinds of crazy monkey patching in order to work. Odds of encountering a bug or scenario that doesn't work for your use case is high in this initial release. Please fill out an issue if any problems pop up! Checkout the examples repo to see the new lifecycle hooks in action.
    • Graceful Shutdown control - Gooey previously would SIGTERM your application when you tried to halt it while running. However, with 1.2.0, you have control over which signal Gooey sends when you request a shutdown. This gives you a chance to catch that signal and clean up and resources currently un use before shutting down.
    • Better sys.argv handling - Gooey no longer mutates the global sys.argv variable. This caused people all kinds of problems -- most frequent being Gooey spawning multiple windows. This is now removed, and hopefully all the pain stemming from it as well.
    Source code(tar.gz)
    Source code(zip)
    Gooey-1.2.0a0.tar.gz(646.79 KB)
  • 1.0.8.1(Jun 12, 2021)

  • 1.0.8(Dec 20, 2020)

    Gooey 1.0.8 Released!

    Another minor Gooey release! This one brings a new global Gooey Option for setting initial values in the UI, support for version action types, plus a few bug/linting fixes.

    Additionally, I continue to plug away at getting the test coverage to useful levels. We're now pushing 80% coverage which is making working on Gooey with confidence much easier!

    New Gooey Options: initial_value

    This option lets you specify the value present in the widget when Gooey starts.

    parser.add_argument('-my-arg', widget='Textarea', gooey_options={
        'initial_value': 'Hello world!'  
    })
    

    Or, using the new options helpers:

    from gooey import options 
    parser.add_argument('-my-arg', widget='Textarea', gooey_options=options.Textarea(
        initial_value='Hello World!'
    ))
    

    If you've been using Gooey awhile, you'll recognize that this overlaps with the current behavior of default. The new initial_value enables you to supply a truly optional seed value to the UI. When using default, even if the user clears your value out of the UI, argparse will add it back in when it parses the CLI string. While this is often useful behavior, it prevents certain workflows from being possible. initial_value let's you control the UI independent of argparse. This means you can now, for instance, set a checkbox to be checked by default in the UI, but optionally allow the user to deselect it without having argprase re-populate the 'checked' state (a behavior which comes up frequently in the issue tracker due to it being technically correct, but also very confusing!).

    action=version support

    When using action='version' Gooey will now map it a CheckBox widget type.

    Other Fixes / Changes:

    • Bug fix: add missing translation step for tabbed group titles (@neonbunny)
    • Linting: swap is not for != (@DrStrinky)

    Breaking Changes

    No breaking API changes from 1.0.7 to 1.0.8

    Thank you to the current Patreon supporters!

    • Sponsors:
      • Qteal
    • Individuals:
      • Joseph Rhodes
      • Nicholas
      • Joey
    Source code(tar.gz)
    Source code(zip)
    Gooey-1.0.8.tar.gz(584.98 KB)
  • 1.0.7(Nov 29, 2020)

    Gooey 1.0.7 Released!

    Lots of new stuff this release! We've got 3 new widget types, new gooey_options, as well as some quality of Life improvements for using Gooey Options.

    New Widgets: IntegerField, DecimalField, and Slider

    Gooey now has 3 inputs specifically geared towards accepting numeric inputs. Previously, all Gooey had were text fields which you could add validators to in order to enforce only numbers were entered, but now we have top level widgets which do all of that out of the box!

    Important Usage Note: since these numeric inputs don't allow any non-numeric characters to be entered, they do not give you the ability to blank them out. Unlike a TextField which can be left empty and thus have its value not passed to your program, the numeric inputs will always send a value. Thus, you have to have sane handling in user-land.

    Checkout the Options docs for more details.

    New Gooey Options: placeholder

    Widgets with text inputs now all accept a placeholder Gooey option.

    add_argument('--foo', widget='TextField', gooey_options=options.TextField(
        placeholder='Type some text here!'
    )
    
    # or without the options helper 
    add_argument('--foo', widget='TextField', gooey_options={
        'placeholder': 'Type some text here!'
    })
    

    New Validator option: RegexValidator

    add_argument('--foo', widget='TextField', gooey_options=options.TextField(
        placeholder='Type some text here!',
        validator=options.RegexValidator(
            test='\d{4}',
            message='Must be exactly 4 digits long!'
        )
    )
    
    # or without the options helper 
    add_argument('--foo', widget='TextField', gooey_options={
        'placeholder': 'Type some text here!',
        'validator': {
            'type': 'RegexValidator',
            'test': '\d{4}',
            'message': 'Must be exactly 4 digits long!'
        }
    })
    

    New feature: Options helpers

    Gooey now has a top-level options module which can be imported. Previously, Gooey Options have been an opaque map. While great for openness / extensibility, it's pretty terrible from a discoverability / "what does this actually take again..?" perspective. The new options module aims to make using gooey_options easier and more discoverable.

    from gooey import options
    

    The goal is to enable IDE's to provide better auto-completion help as well as more REPL driven usefulness via help() and docstrings.

    from gooey import options
    
    parser.add_argument(
        '--foo', 
        help='Some foo thing',
        widget='FilterableDropdown',
        gooey_options=options.FilterableDropdown(
            placeholder='Search for a Foo',
            search_strategy=options.PrefixSearchStrategy(
                ignore_case=True 
            )
        ))
    

    Note that these are just helpers for generating the right data shapes. They're still generating plain data behind the scenes and thus all existing gooey_options code remains 100% compatible.

    Better Docs:

    Which is to say, documentation which actually exists rather than not exist. You can inspect the docs live in the REPL or by hopping to the symbol in editors which support such things.

    >>> from gooey import options 
    >>> help(options.RadioGroup) 
    Help on function FileChooser in module __main__:
    
    FileChooser(wildcard=None, default_dir=None, default_file=None, message=None, **layout_options)
        :param wildcard: Sets the wildcard, which can contain multiple file types, for 
                         example: "BMP files (.bmp)|.bmp|GIF files (.gif)|.gif"
        :param message:  Sets the message that will be displayed on the dialog.
        :param default_dir: The default directory selected when the dialog spawns 
        :param default_file: The default filename used in the dialog
        
        Layout Options:
        ---------------
        
        Color options can be passed either as a hex string ('#ff0000') or as
        a collection of RGB values (e.g. `[255, 0, 0]` or `(255, 0, 0)`)
        
        :param label_color:    The foreground color of the label text
        :param label_bg_color: The background color of the label text.
        :param help_color:     The foreground color of the help text.
        :param help_bg_color:  The background color of the help text.
        :param error_color:    The foreground color of the error text (when visible).
        :param error_bg_color: The background color of the error text (when visible).
        :param show_label:     Toggles whether or not to display the label text
        :param show_help:      Toggles whether or not to display the help text
        :param visible:        Hides the entire widget when False. Note: the widget
                               is still present in the UI and will still send along any
                               default values that have been provided in code. This option
                               is here for when you want to hide certain advanced / dangerous
                               inputs from your GUI users.
        :param full_width:     This is a layout hint for this widget. When True the widget
                               will fill the entire available space within a given row.
                               Otherwise, it will be sized based on the column rules
                               provided elsewhere. 
    

    Ideally, and eventually, we'll be able to completely type these options to increase visibility / usability even more. However, for backwards compatibility reasons, Gooey will continue to be sans anything more than the most basic of type hinting for the time being.

    Breaking Changes

    No breaking API changes from 1.0.6 to 1.0.7. However, the strictness of existing Gooey Options has been increased, which could result in issues when upgrading from 1.0.6. In an attempt to be helpful, Gooey now throws an exception if invalid Gooey Options are supplied. This is to catch things like invalid types or ill-formed data. If you were passing bad data in 1.0.6, it will now be flagged as such in 1.0.7.

    Thank you to the current Patreon supporters!

    • Sponsors:
      • Qteal
    • Individuals:
      • Joseph Rhodes
      • Nicholas
    Source code(tar.gz)
    Source code(zip)
    Gooey-1.0.7.tar.gz(583.06 KB)
  • 1.0.6(Nov 15, 2020)

    Gooey 1.0.6 Released!

    This is a minor release beefing up the new FilterableDropdown's search capabilities and performance. In the previous release, the dropdown was backed by WX's ListBox widget. 1.0.6 replaces this for a fully virtualized version which allows Gooey to operate on massive datasets without taking a hit to UI performance. Additionally, how Gooey internally filters for matches has also been updated. Choice are now backed by a trie for super fast lookup even against large data sets. Tokenization and match strategies can be customized to support just about any lookup style.

    Head over to the Examples Repo to see the updated demo which now uses a datset consisting of about 25k unique items.

    New Gooey Options:

    FilterableDropdown now takes a search_strategy in its gooey_options.

    from gooey import Gooey, GooeyParser, PrefixTokenizers
    
    gooey_options={
        'label_color': (255, 100, 100),
        'placeholder': 'Start typing to view suggestions',
        'search_strategy': {
            'type': 'PrefixFilter',
            'choice_tokenizer': PrefixTokenizers.ENTIRE_PHRASE,
            'input_tokenizer': PrefixTokenizers.REGEX('\s'),
            'ignore_case': True,
            'operator': 'AND',
            'index_suffix': False
        }
    })
    

    This gives control over how the choices and user input get tokenized, as well as how those tokenized matches get treated (ANDed together vs ORd). Want to match on any part of any word? Enable the index_suffix option to index all of your candidate words by their individual parts. e.g.

    Word: 'Banana' 
    Suffixes: ['Banana', 'anana', 'nana', 'ana']
    

    These all get loaded into a trie for super fast lookup. Combine this with the WORDs tokenizer, and you get really fine grained search though your options!

    Thank you to the current Patreon supporters!

    • Qteal
    • Joseph Rhodes

    Breaking Changes

    No breaking changes from 1.0.5.

    Source code(tar.gz)
    Source code(zip)
    Gooey-1.0.6.tar.gz(574.04 KB)
  • 1.0.5(Nov 8, 2020)

    Gooey 1.0.5 Released!

    Gooey is now using WX 4.1.0!

    This change should resolve several issues in Ubuntu as well as the numerous other quirks which have been reported.

    Thank you to the current Patreon supporters!

    • Qteal
    • Joseph Rhodes

    New widgets:

    FilterableDropdown

    Filterable Dropdown

    You can checkout a runnable example in the GooeyExamples repo here

    Example Code:

    add_argument(
        choices=['a', 'b', 'c'],
        widget='FilterableDropdown',
        gooey_options={
            'no_match': 'No results found!',
            'placeholder': 'Type something!'
    })
    

    This introduces a new language translation key: "no_matches_found" to handle the case where the user's input doesn't match any of the choices. This is used by default, but can be overridden via gooey options

    Elapsed Time / Estimated time remaining

    fbHcpCAGD8

    @JackMcKew put in a herculean effort and introduced a new feature where elapsed and estimated remaining time can be shown in addition to the standard progress bar.

    You can checkout an example here

    Example Code:

    @Gooey(timing_options={
        'show_time_remaining':True,
        'hide_time_remaining_on_complete':True
    })
    

    Breaking Changes

    • (documentation breaking)terminal_font_weight's public documented API allowed the strings "NORMAL" and "BOLD" while its internal implementation relied on numeric font weights (light=200, normal=300, etc..). The documentation was updated to show the correct usage and a constants file was added to the public API.

    Functionality

    • @neonbunny enabled Parsers to use configuration from parents.
    • @eladeyal-intel updated RichTextConsole to allow control+scrollwheel to zoom the text

    Language Additions / Improvements

    • @soleil0-0 - Additional Chinese translation
    • @dancergraham - Additional French translation
    • @ajvirSingh1313 - Hindi translation

    Bug Fixes

    • Fixed bug where dynamic updates to a Dropdown would cause the selection to be lost
    • Fixed performance issues where dynamic updates with large items would cause Gooey to hang
    • @rotu fixed a bug in dynamic updates related to Popen usage.
    • @neonbunny - resolved warning cause by missing return statement
    • Fixed bug where terminal font and colors were not being set correctly
    • Fixed mysterious RadioGroup issue where underlying WxWidgets would 'forget' the current selection under certain circumstances
    Source code(tar.gz)
    Source code(zip)
    Gooey-1.0.5.tar.gz(571.46 KB)
  • 1.0.4(Jun 21, 2020)

    Gooey 1.0.4 Released!

    Gooey picked up some cool new widget types thanks to awesome contributions from @NathanRichard and @conradhilley.

    The rest of this release was focused on bug fixes and quality improvements. My commitment is to having Gooey be a stable, reliable project. This has required slowly shedding it's fast and loose hobby project past. Test coverage more than doubled between 1.0.3 and 1.0.4 and several bugs were fixed along the way as a result of this. The next few releases of Gooey will be similarly focused on bringing its codebase up to snuff so that wider changes can be made without introducing unexpected regressions.

    Upgrading from 1.0.3 to 1.0.4

    Translation notice! Yes/No options in confirmation modals are now backed by the language files. Previously, they were fixed to english regardless of the selected language. If the new language options aren't configured for your language, you will now see a translation request in the button label!

    What's new

    Widgets: TimeChooser

    Usage:

    parser = GooeyParser()
    parser.add_argument('--time', widget='TimeChooser')
    

    @NathanRichard added this one after an excellent deep dive into the complexities of dealing with time inside of WX. See the README for notes on usage.

    Widgets: ColourChooser

    Usage:

    parser = GooeyParser()
    parser.add_argument('--color', widget='ColourChooser')
    

    @conradhilley brought this one to life. You can now select colors from an awesome little chooser widget.

    CLI based defaults

    @jschultz added the ability to use arguments passed on the command line as defaults in Gooey. Enable this functionality by passing use_cmd_args to the Gooey decorator.

    @Gooey(use_cmd_args=True)
    def main():
        parser = ArgumentParser()
        parser.add_argument('--foo')
    

    Now any CLI args you pass when invoking your program will show up as defaults in Gooey.

    python my_program.py --foo "hello!" 
    

    Additional features

    • Added option to start Gooey in full screen mode

    Language Additions / Improvements

    • @foben - documentation fixes
    • @gediz - turkish translations
    • @dsardelic - bosnian & Croatian translations
    • @partrita - Korean translations

    Bug Fixes

    • Main README image had a typo "Command Lines Applications"
    • Truthy values
    • Fixed bug where nargs in textfields weren't being mapped correctly
    • Fixed bug where argparse's SUPPRESS flag was showing in the UI
    • Fixed missing i18n capabilities in modals
    • Fixed bug where program_description wasn't being honored
    • Fixed bug where gooey_options weren't being honored in the Header
    • Fixed bug where RadioGroup wasn't enabling it's child widget when initial_selection was set
    • Fixed bug where checkboxes weren't honoring visibility options
    • Fixed bug where gooey_options weren't being passed to footer
    Source code(tar.gz)
    Source code(zip)
  • 1.0.3.1-hotfix(Apr 25, 2020)

    This is a temporary hotfix downgrading the wxpython used by Gooey to 4.0.7.

    WxPython 4.10 introduced unexpected breaking changes. These changes caused Gooey to fail when starting up.

    If you are seeing errors such as this when running Gooey

    wx._core.wxAssertionError: C++ assertion "!(flags & wxALIGN_CENTRE_HORIZONTAL)" failed at ..\..\src\common\sizer.cpp(2106) in wxBoxSizer::DoInsert(): Horizontal alignment flags are ignored in horizontal sizers
    

    This release will resolve them.

    Longer term solution to follow pending additional research.

    Source code(tar.gz)
    Source code(zip)
  • 1.0.3(Sep 22, 2019)

    title card

    After cooking for far too long, Gooey 1.0.3 is released!

    Grab the latest version:

    Runnable demos for all the new features can be found in the Examples repo.

    Overview:

    A lot of focus was put on settling Gooey down into a more stable mature project. In addition to all of the new features, a lot of time was spent writing documentation, stamping down cross platform issues / quirks, and making numerous tweaks and additions to enable a smoother experience when packaging Gooey for distribution.

    What's new

    Fancy Layout controls!

    advanced layout

    The main goal of this release was enabling more complex real-world layouts and more customization of Gooey's UI. As of 1.1.0, you now have have control over every color, font, and display status within the application. You can now brand Gooey to your organization's colors, logically group related items under a central heading, and optionally show/hide all the individual components that make up an input widget.

    Menu Bars

    Gooey now includes a simple declarative system for creating top level menu bars and items.

    menu bar

    The menu option currently supports three flavors:

    AboutDialog

    This is an AboutDialog as rendered natively by your OS. It's a good place to show standard info like version info, descriptions, licenses, etc.. in a standard way across platforms.

    MessageDialogs

    Next up are general message dialogs. You can display any informational text inside of these.

    Link

    Finally, you can create fixed menu items that simply link to external resources, for instance, your site, documentation, pdfs, etc..

    Rich Text Controls

    Thanks to @NathanRichard, Gooey can now optionally honor terminal control sequences and display Rich Text in the output panel.

    rich text

    New Gooey Program Icon

    New icon provided by professional cool guy and crazy talented UX designer Justin Rhee.

    Additional features

    • OSX now shows program Icon in Dock
    • show_error_modal option to toggle whether or not failures additionally raise alert modals.
    • BlockCheckbox widget.
    • Hyperlinks written to the console appear as such and will launch a browser on click
    • clear_before_run option lets you control whether or not subsequent program runs start from a fresh terminal or preserve the previous output.
    • Conditionally show/hide restart button
    • requires_shell option - controls how Popen spawns your program. By default (and historically), this value is False.
    • Optionally silence textual progress updates when using the Progress widget (via @conradhilley)
    • Multi-Directory Choosers - these were accidentally dropped from the project. @HenrykHaniewicz added them back!
    • Additional explicit wx imports to make packaging on OSX easier
    • Textfields can now be made Readonly for informational purposes
    • better custom target support via suppress_gooey_flag which prevents the --ignore-gooey flag from being injected

    Breaking Changes

    No breaking changes between 1.0.0 and 1.1.0!

    Language Additions / Improvements

    • Completed Italian translation - @gison93

    • Updated French translation - @NathanRichard

    • Updated Hebrew translation - @eturkes

    Bug Fixes

    • Fixed 5 year old bug(!) where an errant lambda function wasn't passing through all of its arguments which caused frustratingly opaque failures under specific conditions.
    • Fixed bug where external updates weren't applied to ListBox
    • Fix bug where tuples weren't coerced to List which causes concatenation errors
    • Fixed bug where string coercion in argparse_to_json was too broad and caused type errors
    • Fixed bug where wrong validator was applied to Dropdown type causing preflight checks to always fail
    • Fixed bug where Radio Groups would apply too much vertical spacing between components
    • Fixed bug where subgroups with single items were attached to the wrong UI parent
    • Fixed bug where legacy default groups weren't being translated
    • Fixed bug where certain languages would sometimes cause components to be rendered off screen
    Source code(tar.gz)
    Source code(zip)
Owner
Chris
Full stack developer and general awesome person
Chris
This program is written in python. It will help you find a valid solution for a sudoku puzzle.

Sudoku-Solver-Using-Tkinter This program is written in python. It will help you find a valid solution for a sudoku puzzle. Requirements: Python3 IDLE

Ankan Mahapatra 3 Oct 02, 2021
Use any of the 1k+ free FontAwesome icons in your tkinter application.

TkFontAwesome A library that enables you to use FontAwesome icons in your tkinter application. You may use any of the 1k+ free FontAwesome 5.0 icons.

Israel Dryer 33 Dec 20, 2022
MediaPlayer-with-PyQt5 - The Multimedia Player with Python and PyQt5

MediaPlayer-with-PyQt5 I made this Multimedia Player with Python and PyQt5, I re

4 Oct 06, 2022
FPKG Maker GUI - A user friendly User Interface for fPKG Tools for PS4

Know Issues being worked on Please place this application on the root of a drive

26 Nov 27, 2022
A simple alarm-clock created using Python and Kivy.

Alarm-Clock made with Python and Kivy. A simple alarm-clock created using Python and Kivy. See the time. Set a maximum of 5 alarms. Cancel alarms. Not

Caio 2 Jul 31, 2022
A Url Shortener with GUI made in Python.

Url-Shortener-with-GUI-in-python A Url Shortener with GUI made in Python. To Run this download the zip file and run the main file or Clone this repo.

SidTheMiner 1 Nov 12, 2021
Chatterpatter - A simple GUI complex backend Chat Application made using python

Chatterpatter - A simple GUI complex backend Chat Application made using python

Gurneet Singh 2 Jan 08, 2022
`rosbag filter` with Gooey-based GUI

rosbag_filter_gui rosbag filter with Gooey-based GUI Test-passed Ubuntu 20.04 ROS Noetic Python 3.8 Installation

Yujie He 2 Dec 07, 2021
This is a GUI application to plot functions in the form Y = F(X)

Plotter This is a GUI application to plot functions in the form Y = F(X) Technologies Python Qt designer Python unittest matplotlib Running Navigate

ahmedasad236 3 Dec 26, 2021
Aplicação GUI feita em Python para estudos de cadastro (forms).

Cadastro de DEVs GUI 💻 A ideia original veio do repositório do https://github.com/PedroTomazeti nomeado 'Projetos-Independentes-HTML-CSS' Nele há um

Yago Goltara 3 Aug 15, 2021
A small manager/GUI Frontend for QEMU written in Python

qemu-manager A small manager/GUI Frontend for QEMU written in Python Requirements You'll need to have the following tools installed to run this: QEMU

yeppiidev 15 Dec 21, 2022
This is a short GUI project to evaluate Pbk solution.

Polubarinova-Kochina-solutions (Standalone GUI executables for Windows and Mac) Oden Institute for Computational Engineering and Sciences / Jackson Sc

Mohammad Afzal Shadab 1 Dec 24, 2022
Easily display all of your creative avatars to keep them consistent across websites.

PyAvatar Easily display all of your creative avatars to keep them consistent across websites. Key Features • Download • How To Use • Support • Contrib

William 2 Oct 02, 2022
NiceGUI is an easy to use, Python-based UI framework, which renderes to the web browser.

NiceGUI NiceGUI is an easy to use, Python-based UI framework, which renderes to the web browser. You can create buttons, dialogs, markdown, 3D scences

Zauberzeug GmbH 419 Jan 09, 2023
Python code examples on how to create several applications using Dear PyGui.

Python code examples on how to create several applications using Dear PyGui. Includes building and editing a table, as well as visualizing sorting algorithms in a plot.

Alexander H. 7 Sep 15, 2022
Software com funçoes de A a Z feito no Python

Introdução Iniciante em programação Python, decidi criar um programa com diversas ferramentas de A a Z. Funções Ferramenta de Gerenciamento e Manutenç

João Pedro 1 Jan 26, 2022
A GUI Based Figlet Maker

Figlet Creation Create Figlets easily using this application created using PySimpleGUI. Installation Old-school Straight Pip pip install psg-figlet pi

PySimpleGUI 8 Jan 06, 2023
guietta - a tool for making simple Python GUIs

guietta - a tool for making simple Python GUIs

Alfio Puglisi 1.9k Jan 08, 2023
A Python Tkinter based Inventory managment System

Inventory Management System Using Python Tkinter Introduction Inventory managemrnt system is an open source platform for manage business. It has a com

Amit Kumar Datta 2 Oct 14, 2021
This is the new and improved Plex Automatic Pre-roll script with a GUI

Rollarr This is the new and improved Automatic Pre-roll script with a GUI for Plex now called Rollarr! It should be stable but if you find a bug pleas

164 Nov 04, 2022