Dynamic GUIs - is it possible?

How would you do a dynamic GUI with wx? Essentially, how would you keep the same frame but change around the buttons/text/etc? Is it possible if you know all of the ‘screens’ that you want to create?

Thanks.

Actually wx GUI is dynamic. You can look for example at wxFormBuilder. It can generate a python code, that create all controls in the __init__ funcion. Just cut and past this code to another fuction and create the controls when you need them. Also use Bind functions to change the event processing functions on the run.

Actually, this why I prefer to write code to generate the GUI, rather than using a “resource file” or “template” technique.

It makes it very natural to create data-generated GUIs.

-CHB

···

On Thu, Aug 31, 2017 at 9:23 AM, Michael Salin mikesalin@gmail.com wrote:

Actually wx GUI is dynamic. You can look for example at wxFormBuilder. It can generate a python code, that create all controls in the init funcion. Just cut and past this code to another fuction and create the controls when you need them. Also use Bind functions to change the event processing functions on the run.

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Michael Rosen wrote:

How would you do a dynamic GUI with wx? Essentially, how would you
keep the same frame but change around the buttons/text/etc? Is it
possible if you know all of the 'screens' that you want to create?

Can you be more explicit about what your thinking here? The term
"dynamic GUI" can means a lot of different things. Are you talking
about "theming" an application, or just a few adjustments, or are you
talking about letting the user design an interface?

You can move any of your controls and change their sizes and labels,
although if you use sizers (as you should), moving controls gets to be
tricky.

Consider an app with a notebook, where each notebook page presents a
totally different dialog. That's certainly dynamic. You could achieve
the same kind of thing by deleting all of the controls and sizers on a
frame and rebuilding from scratch. I've done UIs with a "compact" and
"details" mode, where there are a bunch of controls in the right or
bottom half that are chopped off by default, but changing the window
size brings them in.

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Tim Roberts wrote:

Michael Rosen wrote:

How would you do a dynamic GUI with wx? Essentially, how would you
keep the same frame but change around the buttons/text/etc? Is it
possible if you know all of the 'screens' that you want to create?

Can you be more explicit about what your thinking here?

*you're. I saw that within 10ms of hitting "send".

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

You can create/destroy and show/hide widgets on the fly. Also, you can add and detach/remove widgets from sizers.
E.g. wxGlade does this in it's design window.

Changing things on the fly might not be intuitive for the user, though.
Personally, I wrote many dialogs where e.g. the number of controls depends on the context (e.g. number of files being processed). I would not have considered runtime modifications of the main frame. I just decide at startup whether certain widgets are to be added to the main frame.

Regards,

Dietmar

···

On 8/31/2017 3:29 PM, Michael Rosen wrote:

How would you do a dynamic GUI with wx? Essentially, how would you keep the same frame but change around the buttons/text/etc? Is it possible if you know all of the 'screens' that you want to create?

What I mean is that pressing a button makes the visible objects on the frame entirely change, like it’s a different page. All the buttons, text, and even sizers would be different, but a new window is not opened and the frame keeps its properties (like size, position, etc.)

···

On Friday, September 1, 2017 at 2:49:40 AM UTC+8, Tim Roberts wrote:

Michael Rosen wrote:

How would you do a dynamic GUI with wx? Essentially, how would you

keep the same frame but change around the buttons/text/etc? Is it

possible if you know all of the ‘screens’ that you want to create?

Can you be more explicit about what your thinking here? The term

“dynamic GUI” can means a lot of different things. Are you talking

about “theming” an application, or just a few adjustments, or are you

talking about letting the user design an interface?

You can move any of your controls and change their sizes and labels,

although if you use sizers (as you should), moving controls gets to be

tricky.

Consider an app with a notebook, where each notebook page presents a

totally different dialog. That’s certainly dynamic. You could achieve

the same kind of thing by deleting all of the controls and sizers on a

frame and rebuilding from scratch. I’ve done UIs with a “compact” and

“details” mode, where there are a bunch of controls in the right or

bottom half that are chopped off by default, but changing the window

size brings them in.


Tim Roberts, ti...@probo.com

Providenza & Boekelheide, Inc.

How would I remove the objects (like sizers, buttons, etc)? Just sizer.Remove()? Does this have any negative ramifications?

···

On Friday, September 1, 2017 at 12:23:41 AM UTC+8, Michael Salin wrote:

Actually wx GUI is dynamic. You can look for example at wxFormBuilder. It can generate a python code, that create all controls in the init funcion. Just cut and past this code to another fuction and create the controls when you need them. Also use Bind functions to change the event processing functions on the run.

There are two options, at least, you can remove things that you don't
need any more (which means that you have to be careful that there are no
events queued which try to interact with the removed objects), this is
usually done for things that you know will not be needed again.

Alternatively, you can hide the elements which are not needed at the
moment - This tends to be more responsive but still needs some care on
layout, etc.

···

On 01/09/2017 04:35, Michael Rosen wrote:

How would I remove the objects (like sizers, buttons, etc)? Just
sizer.Remove()? Does this have any negative ramifications?

--
Steve (Gadget) Barnes
Any opinions in this message are my personal opinions and do not reflect
those of my employer.

---
This email has been checked for viruses by AVG.

Or you can use one of the bookctrl's.

Karsten

···

On Fri, Sep 01, 2017 at 05:23:13AM +0000, Steve Barnes wrote:

There are two options, at least, you can remove things that you don't
need any more (which means that you have to be careful that there are no
events queued which try to interact with the removed objects), this is
usually done for things that you know will not be needed again.

Alternatively, you can hide the elements which are not needed at the
moment - This tends to be more responsive but still needs some care on
layout, etc.

--
GPG key ID E4071346 @ eu.pool.sks-keyservers.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

How do I hide the elements of one ‘screen’ (layout) but have other elements in approximately the same position?

Is there any way to have the functionality of bookctrl without the look of bookctrl?

···

On Friday, September 1, 2017 at 4:01:42 PM UTC+8, Karsten Hilbert wrote:

On Fri, Sep 01, 2017 at 05:23:13AM +0000, Steve Barnes wrote:

There are two options, at least, you can remove things that you don’t
need any more (which means that you have to be careful that there are no
events queued which try to interact with the removed objects), this is
usually done for things that you know will not be needed again.

Alternatively, you can hide the elements which are not needed at the
moment - This tends to be more responsive but still needs some care on
layout, etc.

Or you can use one of the bookctrl’s.

Karsten


GPG key ID E4071346 @ eu.pool.sks-keyservers.net

E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

How do I hide the elements of one 'screen' (layout) but have other elements
in approximately the same position?

By switching tabs / selecting another "tab".

Have you looked at the examples ?

Is there any way to have the functionality of bookctrl without the look of bookctrl?

Which part of the layout of bookctrls needs to be reconciled
with your design goal ?

Karsten

···

On Fri, Sep 01, 2017 at 03:15:12AM -0700, Michael Rosen wrote:
--
GPG key ID E4071346 @ eu.pool.sks-keyservers.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

You could just put each layout on a separate panel, and hide/show the
panels as necessary.

···

On Fri, Sep 1, 2017 at 6:15 AM, Michael Rosen <totallyformathspace@gmail.com > wrote:

How do I hide the elements of one 'screen' (layout) but have other
elements in approximately the same position?

Is there any way to have the functionality of bookctrl without the look of
bookctrl?

Michael Rosen wrote:

How do I hide the elements of one 'screen' (layout) but have other
elements in approximately the same position?

Is there any way to have the functionality of bookctrl without the
look of bookctrl?

The notebook controls don't have a "look". I suspect you're thinking of
the tab control that is often used to choose a new page, but you don't
have to use that. Think of the old Windows wizards. Same concept,
you're just moving from page to page programmatically,.

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

wxPython is entirely dynamic -- you can add, remove, hide, re-arrange, etc
everything at run time. So yes, you can do all that.

So now the question is how? You can either add/remove or hide/show widgets
-- which makes sense depends on the use case -- once a control "goes away"
-- is it likely to be needed again? if so, you probably want hide it,
rather than removing it.

Then the question is -- as the result of an action, do you want a whole set
of widgets to change?, and the number of possible arrangements is
manageable? In that case, you probably want to put each arrangement on a
wx.Panel, and then you can simple Hide/show the panels you want.

and the "book" controls can mange that for you.

-CHB

···

On Thu, Aug 31, 2017 at 8:29 PM, Michael Rosen < totallyformathspace@gmail.com> wrote:

What I mean is that pressing a button makes the visible objects on the
frame entirely change, like it's a different page. All the buttons, text,
and even sizers would be different, but a new window is not opened and the
frame keeps its properties (like size, position, etc.)

--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

I’ve created a notebook - how would I control the ‘tab’ with a button on the actual panel rather than the list at the top?

···

On Saturday, September 2, 2017 at 4:01:43 AM UTC+8, Chris Barker wrote:

On Thu, Aug 31, 2017 at 8:29 PM, Michael Rosen totallyfo...@gmail.com wrote:

What I mean is that pressing a button makes the visible objects on the frame entirely change, like it’s a different page. All the buttons, text, and even sizers would be different, but a new window is not opened and the frame keeps its properties (like size, position, etc.)

wxPython is entirely dynamic – you can add, remove, hide, re-arrange, etc everything at run time. So yes, you can do all that.

So now the question is how? You can either add/remove or hide/show widgets – which makes sense depends on the use case – once a control “goes away” – is it likely to be needed again? if so, you probably want hide it, rather than removing it.

Then the question is – as the result of an action, do you want a whole set of widgets to change?, and the number of possible arrangements is manageable? In that case, you probably want to put each arrangement on a wx.Panel, and then you can simple Hide/show the panels you want.

and the “book” controls can mange that for you.

-CHB

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris....@noaa.gov

Nevermind, figured it out. Thank you all for your assistance.

···

On Saturday, September 2, 2017 at 3:48:54 PM UTC+8, Michael Rosen wrote:

I’ve created a notebook - how would I control the ‘tab’ with a button on the actual panel rather than the list at the top?

On Saturday, September 2, 2017 at 4:01:43 AM UTC+8, Chris Barker wrote:

On Thu, Aug 31, 2017 at 8:29 PM, Michael Rosen totallyfo...@gmail.com wrote:

What I mean is that pressing a button makes the visible objects on the frame entirely change, like it’s a different page. All the buttons, text, and even sizers would be different, but a new window is not opened and the frame keeps its properties (like size, position, etc.)

wxPython is entirely dynamic – you can add, remove, hide, re-arrange, etc everything at run time. So yes, you can do all that.

So now the question is how? You can either add/remove or hide/show widgets – which makes sense depends on the use case – once a control “goes away” – is it likely to be needed again? if so, you probably want hide it, rather than removing it.

Then the question is – as the result of an action, do you want a whole set of widgets to change?, and the number of possible arrangements is manageable? In that case, you probably want to put each arrangement on a wx.Panel, and then you can simple Hide/show the panels you want.

and the “book” controls can mange that for you.

-CHB

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris....@noaa.gov