Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Widgets should allow enabled, visible at initialisation #90

Closed
martinohanlon opened this issue Dec 31, 2017 · 7 comments
Closed

Widgets should allow enabled, visible at initialisation #90

martinohanlon opened this issue Dec 31, 2017 · 7 comments

Comments

@martinohanlon
Copy link
Collaborator

Widgets which can be enabled, disabled, show, hidden should also allow these values to be set at initilisation, e.g.

Instead of:

button_on = PushButton(app, on, text="On")
button_on.disable()

use

button_on = PushButton(app, on, text="On", enabled = False)
@coal0
Copy link
Contributor

coal0 commented Jan 3, 2018

I'm not too sure, I think we shouldn't go overboard with conciseness. A change of state of any widget is very much fit for a method (since methods are supposed to act on the state of classes, yada yada). Soon we'll be implementing all possible events in widget constructors :)

@lawsie
Copy link
Owner

lawsie commented Jan 3, 2018

Mmm, I'm sort of inclined to agree that this might be too much. The reason I didn't bother implementing hide/show etc. at all to begin with is that I wanted to keep things as simple as possible. It's nice to have lots of stuff you can do but for the vast majority of kids and beginner users they won't need to use any of these methods so it might be best to just leave them as methods for more advanced users.

I guess my philosophy with guizero is to keep things as simple as possible and not overwhelm people with too much choice!

@martinohanlon
Copy link
Collaborator Author

Enabled and visible 'feel' like states which should be set at initialisation and enabling the state of components feels like a useful and widely used use-case.

A simple app with a Start/Stop (or Connect/Disconnect or Open/Close or Horizontal/Vertical) would want to start with 1 button enabled and 1 disabled.

By using defaults the api can be extended offering additional functionality without adding complexity, creating an enabled button is no more complicated than it ever was, whereas you have the option of creating a disabled button at initialisation.

enabled_button = PushButton(app, command)
disabled_button = PushButton(app, command, enabled = False)

Its clearly not a priority, but its a simple change and adds some functionality.

@coal0
Copy link
Contributor

coal0 commented Jan 3, 2018

Welp, you've convinced me.

m4ddav3 added a commit to m4ddav3/guizero that referenced this issue Jan 23, 2018
All done except ButtonGroup. These look like they need better/more
methods to interact with the individual options
@m4ddav3
Copy link
Contributor

m4ddav3 commented Jan 24, 2018

Hi,
I recently came across this framework after reading about it in (Hello World) magazine at a school, and immediately used it for a Langton's Ant exercise and to get myself back into Python.

I've started implementing the enabled=boolean functionality on the widgets as I needed it to make my interface feel move intuitive. I later came across this very issue describing it. I still have to complete it for the ButtonGroup and MenuBar widgets.

You have mentioned visibility as well but it is unclear if that functionality is required..?
I agree that visibility feels like a state that should be controllable, but I'm unsure of the ultimate goal here.

@martinohanlon
Copy link
Collaborator Author

I had to add visibility to Window in order to be able to create a window which isnt displayed immediately so I have included this in v 0.5.0

@martinohanlon
Copy link
Collaborator Author

resolved in v0.5.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants