Skip to content

Commit

Permalink
Changed label #235
Browse files Browse the repository at this point in the history
Label not takes a type.

Updated docs
  • Loading branch information
jarvisteach committed Nov 5, 2017
1 parent 9e4b6fd commit 16d9d2d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
7 changes: 3 additions & 4 deletions appJar/appjar.py
Original file line number Diff line number Diff line change
Expand Up @@ -6943,11 +6943,10 @@ def label(self, title, value=None, *args, **kwargs):
try: self.widgetManager.verify(self.Widgets.Label, title)
except: self.setLabel(title, value)
else:
flash = False if "flash" not in kwargs else kwargs.pop("flash")
selectable = False if "selectable" not in kwargs else kwargs.pop("selectable")
type = "standard" if "type" not in kwargs else kwargs.pop("type").lower().strip()

if flash: label = self.addFlashLabel(title, value, *args, **kwargs)
elif selectable: label = self.addSelectableLabel(title, value, *args, **kwargs)
if type == "flash": label = self.addFlashLabel(title, value, *args, **kwargs)
elif type == "selectable": label = self.addSelectableLabel(title, value, *args, **kwargs)
else: label = self.addLabel(title, value, *args, **kwargs)

return label
Expand Down
11 changes: 5 additions & 6 deletions docs/mkdocs/docs/simpleAppJar.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# appJar 2.0
---

We are moving away from adding, setting & getting widgets.
You can now use the same function for all three tasks.
Expand All @@ -10,7 +9,8 @@ You can now use the same function for all three tasks.
app.label("title", "text") # ADD a label
app.label("title", "text_2") # SET a label
print(app.label("title")) # GET a label
```
```


## Label
A widget for displaying text in a GUI.
Expand All @@ -21,8 +21,7 @@ A widget for displaying text in a GUI.
| --------- | --------- | ------- | ---------- | ------------|
| title | string | - | Yes | A unique identifier for the widget. |
| value | string | - | Yes | The text to display in the widget. |
| selectable | boolean | - | No | Create a flashing label. |
| flash | boolean | - | No | Create a selectable label. |
| type | string | standard | No | Set to "selectable" or "flash" to create different labels. |
| row | integer | next row | No | The grid row to place the widget in. |
| column | integer | 0 | No | The grid column to place the widget in. |
| rowspan | integer | 1 | No | The number of grid rows to stretch the widget across. |
Expand Down Expand Up @@ -54,12 +53,12 @@ An interactive widget, for capturing user input in a GUI.
| value | string | - | Yes | The text to display in the widget. |
| default | string | - | No | Sets default text to display in an empty entry. |
| secret | boolean | False | No | Configures the entry box to show stars instead of characters. |
| type | string | "standard" | No | Sets the type of the entry box. |
| type | string | standard | No | Sets the type of the entry box. |
| focus | boolean | False | No | Should the entry box be given focus? |
| limit | integer | - | No | Sets a maximum limit on the number of characters taht can be entered. |
| case | string | - | No | Set to "upper" to force upercase or "lower" to force lowercase. |
| autorows | integer | - | No | If the type is "auto" this will set the number of rows to show. |
| row | integer | <next row> | No | The grid row to place the widget in. |
| row | integer | next row | No | The grid row to place the widget in. |
| column | integer | 0 | No | The grid column to place the widget in. |
| rowspan | integer | 1 | No | The number of grid rows to stretch the widget across. |
| colspan | integer | 1 | No | The number of grid columns to stretch the widget across. |
Expand Down
2 changes: 1 addition & 1 deletion examples/issues/issue235.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def press(btn):
app.meter("CryingMorerr", (app.slider("happiness again"),app.scale("happiness again")))

with gui("Simple Demo") as app:
app.label("title", "Simple Props Demo", colspan=3, flash=True)
app.label("title", "Simple Props Demo", colspan=3, type="flash")
app.setLabelBg("title", "green")

app.radio("happy", "Very Happy", row=1, column=0)
Expand Down

0 comments on commit 16d9d2d

Please sign in to comment.