Dynamic GUIs - is it possible?

classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|

Dynamic GUIs - is it possible?

Michael Rosen
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.

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Dynamic GUIs - is it possible?

Michael Salin
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic GUIs - is it possible?

Chris Barker - NOAA Federal
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 <[hidden email]> 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 [hidden email].
For more options, visit https://groups.google.com/d/optout.



--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            <a href="tel:(206)%20526-6959" value="+12065266959" target="_blank">(206) 526-6959   voice
7600 Sand Point Way NE   <a href="tel:(206)%20526-6329" value="+12065266329" target="_blank">(206) 526-6329   fax
Seattle, WA  98115       <a href="tel:(206)%20526-6317" value="+12065266317" target="_blank">(206) 526-6317   main reception

[hidden email]

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic GUIs - is it possible?

Tim Roberts
In reply to this post by Michael Rosen
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, [hidden email]
Providenza & Boekelheide, Inc.

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic GUIs - is it possible?

Tim Roberts
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, [hidden email]
Providenza & Boekelheide, Inc.

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic GUIs - is it possible?

Dietmar Schwertberger-2
In reply to this post by Michael Rosen
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?

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


--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic GUIs - is it possible?

Michael Rosen
In reply to this post by Tim Roberts
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, <a href="javascript:" target="_blank" gdf-obfuscated-mailto="iRzvUMA9BAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">ti...@...
Providenza & Boekelheide, Inc.

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic GUIs - is it possible?

Michael Rosen
In reply to this post by Michael Salin
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.

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic GUIs - is it possible?

GadgetSteve


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?
>
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.

--
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.
http://www.avg.com

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic GUIs - is it possible?

Karsten Hilbert
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

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic GUIs - is it possible?

Michael Rosen
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 @ <a href="http://eu.pool.sks-keyservers.net" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Feu.pool.sks-keyservers.net\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHH-WzSJsxHtOoeYAkrceun47rQ_Q&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Feu.pool.sks-keyservers.net\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHH-WzSJsxHtOoeYAkrceun47rQ_Q&#39;;return true;">eu.pool.sks-keyservers.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic GUIs - is it possible?

Karsten Hilbert
On Fri, Sep 01, 2017 at 03:15:12AM -0700, Michael Rosen wrote:

> 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
--
GPG key ID E4071346 @ eu.pool.sks-keyservers.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic GUIs - is it possible?

Michael Moriarity
In reply to this post by Michael Rosen

On Fri, Sep 1, 2017 at 6:15 AM, Michael Rosen <[hidden email]> 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?


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

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic GUIs - is it possible?

Tim Roberts
In reply to this post by Michael Rosen
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, [hidden email]
Providenza & Boekelheide, Inc.

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic GUIs - is it possible?

Chris Barker - NOAA Federal
In reply to this post by Michael Rosen
On Thu, Aug 31, 2017 at 8:29 PM, Michael Rosen <[hidden email]> 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

[hidden email]

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic GUIs - is it possible?

Michael Rosen
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 <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="hPqvhkOQBAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">totallyfo...@...> 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

<a href="javascript:" target="_blank" gdf-obfuscated-mailto="hPqvhkOQBAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">Chris....@...

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic GUIs - is it possible?

Michael Rosen
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 <[hidden email]> 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

[hidden email]

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.