Gooey (Beta)
=====
Turn (almost) any Python 2 or 3 Console Program into a GUI application with one line
<p align="center">
<img src="https://cloud.githubusercontent.com/assets/1408720/7904381/f54f97f6-07c5-11e5-9bcb-c3c102920769.png" />
</p>
# Gooey now supports Python 3!!
Table of Contents
-----------------
- [Gooey](#gooey)
- [Table of contents](#table-of-contents)
- [Latest Update](#latest-update)
- [Quick Start](#quick-start)
- [Installation Instructions](#installation-instructions)
- [Usage](#usage)
- [Examples](#examples)
- [What It Is](#what-is-it)
- [Why Is It](#why)
- [Who is this for](#who-is-this-for)
- [How does it work](#how-does-it-work)
- [Internationalization](#internationalization)
- [Global Configuration](#global-configuration)
- [Layout Customization](#layout-customization)
- [Run Modes](#run-modes)
- [Full/Advanced](#advanced)
- [Basic](#basic)
- [No Config](#no-config)
- [Input Validation](#input-validation)
- [Using Dynamic Values](#using-dynamic-values)
- [Customizing Icons](#customizing-icons)
- [Packaging](#packaging)
- [Screenshots](#screenshots)
- [Contributing](#wanna-help)
- [Image Credits](#image-credits)
----------------
## 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](http://www.wxpython.org/download.php).
### 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
show_config=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 columbs 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](#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](#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](https://github.com/chriskiehl/GooeyExamples) 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](https://github.com/chriskiehl/GooeyExamples/archive/master.zip)
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 | <img src="https://cloud.githubusercontent.com/assets/1408720/7904380/f54e9f5e-07c5-11e5-86e5-82f011c538cf.png"/>|
| store_const | CheckBox | <img src="https://cloud.githubusercontent.com/assets/1408720/7904367/f538c850-07c5-11e5-8cbe-864badfa54a9.png"/>|
| store_true| CheckBox | <img src="https://cloud.githubusercontent.com/assets/1408720/7904367/f538c850-07c5-11e5-8cbe-864badfa54a9.png"/>|
| store_False | CheckBox| <img src="https://cloud.githubusercontent.com/assets/1408720/7904367/f538c850-07c5-11e5-8cbe-864badfa54a9.png"/> |
| append | TextCtrl | <img src="https://cloud.githubusercontent.com/assets/1408720/7904380/f54e9f5e-07c5-11e5-86e5-82f011c538cf.png"/> |
| count| DropDown | <img src="https://cloud.githubusercontent.com/assets/1408720/7904371/f53ccbe4-07c5-11e5-80e5-510e2aa22922.png"/> |
| Mutually Exclusive Group | RadioGroup | <img src="https://cloud.githubusercontent.com/assets/1408720/7904383/f553feb8-07c5-11e5-9d5b-eaa4772075a9.png"/>
|choice | DropDown | <img src="https://cloud.githubusercontent.com/assets/1408720/7904379/f54e4da6-07c5-11e5-9e66-d8e6d7f18ac6.png"/> |
### GooeyParser
If the above defaults aren't cutting it, you can control the exact widget t
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
共110个文件
py:76个
json:17个
txt:5个
资源分类:Python库 所属语言:Python 资源全名:Gooey-1.0.1.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
资源推荐
资源详情
资源评论
收起资源包目录
Python库 | Gooey-1.0.1.tar.gz (110个子文件)
setup.cfg 42B
loading_icon.gif 11KB
program_icon.ico 34KB
MANIFEST.in 195B
images.jpg 1.35MB
greek.json 2KB
russian.json 2KB
korean.json 2KB
hebrew.json 2KB
portuguese.json 2KB
japanese.json 2KB
vietnamese.json 2KB
dutch.json 2KB
italian.json 2KB
french.json 2KB
spanish.json 2KB
bosnian.json 2KB
german.json 2KB
traditional-chinese.json 2KB
english.json 2KB
czech.json 2KB
chinese.json 2KB
README.md 29KB
PKG-INFO 2KB
PKG-INFO 2KB
success_icon.png 13KB
error_icon.png 8KB
config_icon.png 6KB
running_icon.png 3KB
argparse_to_json.py 11KB
application.py 9KB
config.py 7KB
test_integration.py 7KB
gooey_parser.py 6KB
test_argparse_to_json.py 6KB
all_widgets_subparser.py 5KB
radio_group.py 5KB
bases.py 5KB
config_generator.py 5KB
footer.py 5KB
processor.py 3KB
header.py 3KB
all_widgets.py 3KB
gooey_decorator.py 3KB
chooser.py 3KB
sidebar.py 3KB
beep_boop.py 3KB
console.py 2KB
functional.py 2KB
formatters.py 2KB
docopt_to_json.py 2KB
wx_util.py 2KB
setup.py 2KB
test_processor.py 2KB
image_repository.py 1KB
calender_dialog.py 1KB
checkbox.py 1KB
test_language_parity.py 1KB
modals.py 1KB
text_input.py 1KB
tabbar.py 1KB
freeze.py 1KB
dropdown.py 1KB
listbox.py 871B
three_to_four.py 869B
i18n.py 832B
choosers.py 760B
imageutil.py 712B
application.py 698B
seeder.py 661B
textfield.py 577B
auto_start.py 568B
events.py 559B
pubsub.py 504B
cli.py 485B
counter.py 375B
layouts.py 374B
__init__.py 366B
password.py 345B
parser_exceptions.py 335B
taskkill.py 330B
quoting.py 259B
filedrop.py 252B
validators.py 237B
__main__.py 234B
textarea.py 210B
casting.py 209B
i18n_config.py 174B
__init__.py 169B
__init__.py 153B
command.py 141B
constants.py 80B
__init__.py 22B
__init__.py 22B
__init__.py 22B
__init__.py 22B
functional.py 12B
__init__.py 0B
__init__.py 0B
__init__.py 0B
共 110 条
- 1
- 2
资源评论
挣扎的蓝藻
- 粉丝: 12w+
- 资源: 15万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功