Dynamic wxPython Form

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

Dynamic wxPython Form

JerryEF

I have been working with Python for about 6 months and learning wxPython for about a month. I have > 30 years programing experience with PL/1, Pascal,  C, C++ but not much GUI experience. I am at the point where I can get basic screens and menus working reliably (more or less).  As I prepare to do a ‘Real” applications I am stumped with how to proceed.


I am building a transaction entry GUI.  I am looking for the best way to implement a dynamic entry form.  Specifically, based on the contents of the first 1 or 2 fields, the remainder of the input screen can vary: 2 - 6 input fields.  One of the obvious ways of solving this general class of problem is to use the Wizard approach with a series of forms based on the input of the prior form.  I don’t like the Wizard approach for this application. I envision a top area of the form where the first entries are made, then the bottom portion of the form is created and displayed.  If the user goes back to the top portion of the form and changes a field that calls for a different lower portion … it happens.


None of the books or blogs I have found discuss this approach.  Can someone point me to a book or blog, or whatever than can get me moving forward again?

--
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 wxPython Form

Bzzzz
On Sun, 24 Dec 2017 06:40:01 -0800 (PST)
JerryEF <[hidden email]> wrote:
 
> I am building a transaction entry GUI.  I am looking for the best way
> to implement a dynamic entry form.  Specifically, based on the
> contents of the first 1 or 2 fields, the remainder of the input screen
> can vary: 2 - 6 input fields.

The easiest way to do so would be to implement all these 2-6 input
fields in your form, hiding them (invisible to the user) or disabling
them (grayed and unreachable to the user) and unhide||enable them
selectively after the test of the 2 first inputs.

May be hiding them would be a cleaner way to do that (IIRC, hiding means
the first to be unhidden will stay on top of it's sizer.)

>  I envision a top area of the
> form where the first entries are made, then the bottom portion of the
> form is created and displayed.  If the user goes back to the top
> portion of the form and changes a field that calls for a different
> lower portion … it happens.

Then, may be displaying all fields and disable them until the first 2 are
tested is the way to go (well, it is also the easiest as it won't give
you a headache about fields placement;)

> None of the books or blogs I have found discuss this approach.  Can
> someone point me to a book or blog, or whatever than can get me moving
> forward again?
 
Using wxformbuilder could help to build your app, as it is really easy to
use and produces correct code allowing to use the generated Python file
as your own class.
You also have a lot of sites that help with wx, Python or not; google is
your friend for that.

Jiff

--
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 wxPython Form

GadgetSteve
In reply to this post by JerryEF


On 24/12/2017 14:40, JerryEF wrote:

> I have been working with Python for about 6 months and learning wxPython
> for about a month. I have > 30 years programing experience with PL/1,
> Pascal,  C, C++ but not much GUI experience. I am at the point where I
> can get basic screens and menus working reliably (more or less).  As I
> prepare to do a ‘Real” applications I am stumped with how to proceed.
>
>
> I am building a transaction entry GUI.  I am looking for the best way to
> implement a dynamic entry form.  Specifically, based on the contents of
> the first 1 or 2 fields, the remainder of the input screen can vary: 2 -
> 6 input fields.  One of the obvious ways of solving this general class
> of problem is to use the Wizard approach with a series of forms based on
> the input of the prior form. I don’t like the Wizard approach for this
> application. I envision a top area of the form where the first entries
> are made, then the bottom portion of the form is created and displayed.
>   If the user goes back to the top portion of the form and changes a
> field that calls for a different lower portion … it happens.
>
>
> None of the books or blogs I have found discuss this approach.  Can
> someone point me to a book or blog, or whatever than can get me moving
> forward again?
>
Jerry,

I can't emphasise enough - download and try the wxPython demo package -
you will find examples of the sort of thing that you are trying to do
there complete with re-usable code.

The packages for the latest versions of wxPython are all under
https://extras.wxpython.org/wxPython4/extras



--
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 wxPython Form

JerryEF
In reply to this post by Bzzzz
Thank you

--
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 wxPython Form

Chris Barker - NOAA Federal
In reply to this post by Bzzzz
On Sun, Dec 24, 2017 at 10:33 AM, Bzzzz <[hidden email]> wrote:
The easiest way to do so would be to implement all these 2-6 input
fields in your form, hiding them (invisible to the user) or disabling
them (grayed and unreachable to the user) and unhide||enable them
selectively after the test of the 2 first inputs.

if it is a pretty static 2-6 entries, then yes, this is a good way to go.

But, if, in fact, it could be a wider possible compilation of multiple different entries -- perhaps depending on what data the user provides, or what data is in a database, or ...

Then you can build a fully dynamic GUI in code -- code runs that crates the widgets you need, puts them in a Sizer for layout, and calls refresh on the Panel you have them all on.

I can't think of a good example to point you to -- but essentially the same code that you'd write to building a form at startup can be run at any time.

-CHB








 
May be hiding them would be a cleaner way to do that (IIRC, hiding means
the first to be unhidden will stay on top of it's sizer.)

>  I envision a top area of the
> form where the first entries are made, then the bottom portion of the
> form is created and displayed.  If the user goes back to the top
> portion of the form and changes a field that calls for a different
> lower portion … it happens.

Then, may be displaying all fields and disable them until the first 2 are
tested is the way to go (well, it is also the easiest as it won't give
you a headache about fields placement;)

> None of the books or blogs I have found discuss this approach.  Can
> someone point me to a book or blog, or whatever than can get me moving
> forward again?

Using wxformbuilder could help to build your app, as it is really easy to
use and produces correct code allowing to use the generated Python file
as your own class.
You also have a lot of sites that help with wx, Python or not; google is
your friend for that.

Jiff

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