Giter VIP home page Giter VIP logo

quick's Introduction

QUICK

A real quick GUI generator for click. Inspired by Gooey, the GUI generator for classical Python argparse-based command line programs.

Install

python setup.py install

Usage

Overview

Open your terminal, go into the downloaded source folder and input

python test.py

Then click "Run" button. You will see something like this.

screenshot

Open test.py to see what the original click-based program looks like.

Basic usage

This package could draw the gui for a click-based CLI program with a very simple function gui_it. The usage is wrapping the command function example_cmd() like gui_it(example_cmd). The full example is like this.

from quick import gui_it
import click

@click.command()
@click.option("--hello", default="world", help="say hello")
@click.option("--add", type=int, help="input an integer number",\
              hide_input=True)
@click.option("--minus", type=float, help="input two numbers", nargs=2)
@click.option("--flag", is_flag=True)
@click.option('--shout/--no-shout', default=True)
@click.option('--language', type=click.Choice(['c', 'c++']))
@click.option('-v', '--verbose', count=True)
def example_cmd(**argvs):
    for k, v in argvs.items():
        print(k, v, type(v))


if __name__ == "__main__":
    # example_cmd()
    gui_it(example_cmd)

Add --gui option to your command

A common case is not changing all your command into a gui version, but just add a --gui option to it. Then you can do this.

from quick import gui_option
import click

@gui_option
@click.group()
@click.option('--debug/--no-debug', default=False)
def cli(debug):
    print(debug)


@cli.command()
@click.argument("arg", nargs=-1)
@click.option("--hello", default="world", help="say hello")
@click.option('-v', '--verbose', count=True)
def example_cmd(**argvs):
    for k, v in argvs.items():
        print(k, v, type(v))


@cli.command()
@click.option("--hello")
def sync(hello):
    print('Synching', hello)


@cli.command()
def func(**argvs):
    pass

if __name__ == "__main__":
    cli()

Writing you own widget

For developer

Travis CI is used for continuous integration.

Copyright

see LICENCE

quick's People

Contributors

bittner avatar idahogray avatar pombredanne avatar szsdk avatar thismachinechills avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.