Skip to content

Commit

Permalink
Merge pull request #342 from lawsie/dev
Browse files Browse the repository at this point in the history
v1.1
  • Loading branch information
Martin O'Hanlon authored Oct 25, 2019
2 parents 6cc1c93 + 77d4d9a commit be29843
Show file tree
Hide file tree
Showing 56 changed files with 943 additions and 241 deletions.
2 changes: 1 addition & 1 deletion docs-src/docs/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ The aim of guizero is to make the process of creating simple GUIs quick, accessi

### Version

guizero is currently [version 1.0.0](changelog.md)
guizero is currently [version 1.1.0](changelog.md)

64 changes: 63 additions & 1 deletion docs-src/docs/alerts.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ info("info", "this is a guizero app")
```

### Purpose
These functions pop up a box on the screen that displays a message. The functions available are:
These functions pop up a box on the screen that displays a message or asks a question. The functions available are:

* `warn(title, text)` - popup box with a warning icon
* `info(title, text)` - popup box with an information icon
* `error(title, text)` - popup box with an error icon
* `yesno(title, text)` - popup box with yes and no options. Pressing `Yes` returns `True` and pressing `No` returns `False`.
* `question(title, text, initial_value=None)` - popup box with a question box which can accept a text response. Pressing `Ok` returns value entered into the box is returned and pressing `Cancel` returns `None`.
* `select_file(title="Select file", folder=".", filetypes=[["All files", "*.*"]], save=False)` - popup file dialog box which asks the user to select a file. By default, an *Open* button is displayed, setting `save` to `True` will change the button to *Save as*. The path of the selected file is returned by the function.
* `select_folder(title="Select folder", folder=".")` - popup box which asks the user to select a folder. The path of the selected folder is returned by the function.

All pop up boxes use the native display, so they will look different depending on your operating system.

Expand Down Expand Up @@ -140,3 +142,63 @@ app.display()
```

![question popu](images/question_windows.png)

** Example: Get a file name**

Ask the user to select a file using the `select_file` pop-up.

```python
from guizero import App, PushButton, Text

def get_file():
file_name.value = app.select_file()

app = App()

PushButton(app, command=get_file, text="Get file")
file_name = Text(app)

app.display()
```

![select file popup](images/select_file_windows.png)

You can change the file type filter by providing a list of type descriptions and extensions as the `filetypes` parameter e.g.

```python
file_name.value = app.select_file(filetypes=[["All files", "*.*"], ["Text documents", "*.txt"]])
```

The default is to show an *Open* button, this can be changed to a *Save* button by setting the `save` parameter to `True` e.g.

```python
file_name.value = app.select_file(save=True)
```

![select save file popup](images/select_file_save_windows.png)

** Example: Get a folder name**

Select a folder using the `select_folder` pop-up.

```python
from guizero import App, PushButton, Text

def get_folder():
path.value = app.select_folder()

app = App()

PushButton(app, command=get_folder, text="Get path")
path = Text(app)

app.display()
```

![select folder popup](images/select_file_windows.png)

You can set the initial folder by passing a path to the `folder` parameter

```python
file_name.value = app.select_file(folder="c:\users\lawsie")
```
33 changes: 18 additions & 15 deletions docs-src/docs/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ You can call the following methods on an `App` object.
| info(title, text) | title (str), text (str) | - | Displays a popup box with an information icon |
| question(title, text, initial_value=None) | title (str), text (str), initial_value (str) | Pressing `Ok` returns value entered into the box is returned and pressing `Cancel` returns `None` | Displays a popup box with a question box which can accept a text response |
| repeat(time, command, args=None) | time (int), command (function name), args (list of arguments) | - | Repeats `command` every `time` milliseconds. This is useful for scheduling a function to be regularly called, for example updating a value read from a sensor. |
| select_file(title="Select file", folder=".", filetypes=[["All files", "*.*"]], save=False) | title (str), folder (str), filetypes (list), save (bool) | Full path of the file selected as a string | Display a box to select a file to open or save. If Open or Save is pressed the filename path is returned. If Cancel is pressed `None` is returned. |
| select_folder(title="Select folder", folder=".") | title (str), folder (str) | Full path of the folder selected as a string | Display a box to select a folder. If a folder is selected the folder path is returned, otherwise `None` is returned. |
| set_full_screen(keybind) | String | - | Set the application to display full screen. Option to specify a key to exit full screen (default is 'Esc'.) |
| show() | - | - | Displays the app window if it was previously hidden |
| update() | - | - | Force the application to update itself, useful if changes aren't reflected in the UI. |
| set_full_screen(keybind) | String | - | Set the application to display full screen. Option to specify a key to exit full screen (default is 'Esc'.) |
| warn(title, text) | title (str), text (str) | - | Displays a popup box with a warning icon |
| yesno(title, text) | title (str), text (str) | Pressing `Yes` returns `True` and pressing `No` returns `False` | Displays a popup box with yes and no options |
| _on_close(command)_ | _command (function name)_ | - | _Calls the given function when the user tries to close the window._ |
Expand All @@ -75,20 +77,21 @@ Parameters in _italics_ will still work but are **deprecated** - this means you

You can set and get the following properties:

| Method | Data type | Description | | |
|-------------|--------------------|--------------------------------------------------------------------------------------------|-----|--------------------------------|
| bg | [color](colors.md) | The background colour of the window | | |
| enabled | boolean | `True` if the app is enabled | | |
| height | int | The height of the window | | |
| font | string | The font that widgets should use | | |
| full_screen | boolean | False | No | Whether the App is full screen |
| layout | string | The layout being used by the App (`"auto"`) or (`"grid"`) | | |
| title | string | The title of the window | | |
| text_size | int | The size of the text widgets should use | | |
| text_color | [color](colors.md) | The colour of the text widgets should use | | |
| visible | boolean | If the app is visible | | |
| width | int | The width of the window | | |
| when_closed | function | The function to call when the `App` is closed. Setting to `None` (the default) will reset. | | |
| Method | Data type | Description |
|-------------|--------------------|--------------------------------------------------------------------------------------------|
| bg | [color](colors.md) | The background colour of the window |
| children | list(widgets) | A list of widgets in this container |
| enabled | boolean | `True` if the app is enabled |
| height | int | The height of the window |
| font | string | The font that widgets should use |
| full_screen | boolean | False |
| layout | string | The layout being used by the App (`"auto"`) or (`"grid"`) |
| title | string | The title of the window |
| text_size | int | The size of the text widgets should use |
| text_color | [color](colors.md) | The colour of the text widgets should use |
| visible | boolean | If the app is visible |
| width | int | The width of the window |
| when_closed | function | The function to call when the `App` is closed. Setting to `None` (the default) will reset. |


Refer to a property as `<name of widget>.property`. For example, if your `App` object is called `app` you would write `app.title`.
Expand Down
1 change: 1 addition & 0 deletions docs-src/docs/box.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ You can set and get the following properties:
| align | string | The alignment of this widget within its container |
| border | int | The border thickness, setting to `0` or `False` (the default) there is no border. |
| bg | [color](colors.md) | The background colour of the widget |
| children | list(widgets) | A list of widgets in this container |
| enabled | boolean | `True` if the box is enabled |
| grid | List | `[x,y]` coordinates of this widget. This parameter is only required if the `master` object has a grid |
| font | string | The font that widgets should use |
Expand Down
8 changes: 8 additions & 0 deletions docs-src/docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# guizero

## 1.1.0 - 2019-10-25
- Added ability to be able to change the grid of a widget at room time
- Added `hide_text` to `TextBox` for use with passwords
- Added open file and folder popups `select_file` and `select_folder`
- Changes to `Text` to better support cascading of text color, font and size
- Various documentation updates
- contributors [martinohanlon](https://github.com/martinohanlon), [lawsie](https://github.com/lawsie)

## 1.0.0 - 2019-07-11
- Previously deprecated methods have now been removed
- Resolved race condition in the `repeat`, `cancel` methods
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs-src/docs/images/select_file_windows.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs-src/docs/images/select_folder_windows.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs-src/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ If you installed guizero using the easy install method, to upgrade you should fo
If you are using Windows you can install guizero by downloading and running a Windows MSI installer application.
1. Download either the [64-bit guizero installer](https://github.com/lawsie/guizero/releases/latest/download/guizero-1.0.0.amd64.msi) or the [32-bit guizero installer](https://github.com/lawsie/guizero/releases/latest/download/guizero-1.0.0.win32.msi) depending on which version of Python you are using.
1. Download either the [64-bit guizero installer](https://github.com/lawsie/guizero/releases/latest/download/guizero-1.1.0.amd64.msi) or the [32-bit guizero installer](https://github.com/lawsie/guizero/releases/latest/download/guizero-1.1.0.win32.msi) depending on which version of Python you are using.
**Note:** If you are not sure what version of python you are running, run the following program in Python, which will output either `32` or `64`:
Expand Down
2 changes: 1 addition & 1 deletion docs-src/docs/recipes.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Get some data from the user using a `TextBox`.
from guizero import App, TextBox

app = App()
name = TextBox(app. text="Enter your name")
name = TextBox(app, text="Enter your name")

app.display()
```
Expand Down
Loading

0 comments on commit be29843

Please sign in to comment.