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

Example code to position a gui #17

Open
ricardocanada opened this issue Aug 10, 2019 · 1 comment
Open

Example code to position a gui #17

ricardocanada opened this issue Aug 10, 2019 · 1 comment

Comments

@ricardocanada
Copy link

ricardocanada commented Aug 10, 2019

39DEEEA5-B39C-48A1-B81B-2CE257B14F91
I am using p5.gui with QuickSettings in many of my OpenProcessing sketches. If you are interested, look for sketches 743514 and 743509, in which I use p5.GUI sliders to set hue, saturation and brightness for fullscreen gradients. It is a great timesaver. I agree with the idea that it would be nice to have a button element included. Up until now I have used checkboxes as buttons, but I am looking forward to using a user solution posted in Issues. I reread the p5.GUI information page several times to find out how to position a GUI, and tried the code suggested there:

let gui1 = p.createGui('My 1st GUI');
gui1.moveTo(50, 50);
gui1.addGlobals('a', 'b', 'c');

It would not work. The console error was:
TypeError: gui.moveTo is not a function. (In 'gui.moveTo(50, 50)', 'gui.moveTo' is undefined)

Then I happened to notice a different positioning method shown in one of the examples.

gui = createGui('p5.GUI').setPosition(width - 250, 120);

That one works perfectly, so I suggest using it, and error-checking the other method.

@ricardocanada ricardocanada changed the title Example code for position a GUI Example code to position a gui Aug 10, 2019
@anugrahandi
Copy link

Thanks.. did search from readme/documentation on move the GUI on the first run land me here. I use:
gui = createGui('name of my GUI');
gui.setPosition(50,50);

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

No branches or pull requests

2 participants