Suggestions for wxPython Widget

After spending a lot of time creating a notebook with nested pages each
holding a variable number of data entry widgets I now realize that this is
not the correct approach. The notebook with nested pages will work well, but
what's really needed is a widget that displays all rows in the backend
database table. There are several in the wxPython-3.0.0.0 and since I've no
experience with any of them I'd appreciate your thoughts.

   I suspect that what I want is one of the DVC (DataViewCtrl) widgets or a
list control. What criteria do I apply to decide which might be the most
appropriate for entering (and editing) variable types of data?

   Pointers to example applications using these widgets would be nice.

TIA,

Rich

Hi Rich,

Offhand, it seems like they all do about the same thing relative to your needs: show rows and column headers. I tend to think in terms of grids when browsing databases (such as with SQLite Database Browser), so then I guess wxGrid would be good, and found this write-up about using it with an SQLite database:

http://www.salstat.com/news/linking-wxgrid-to-sqlite-database-in-python-an-example

Che

···

On Tue, Feb 24, 2015 at 5:42 PM, Rich Shepard rshepard@appl-ecosys.com wrote:

After spending a lot of time creating a notebook with nested pages each

holding a variable number of data entry widgets I now realize that this is

not the correct approach. The notebook with nested pages will work well, but

what’s really needed is a widget that displays all rows in the backend

database table. There are several in the wxPython-3.0.0.0 and since I’ve no

experience with any of them I’d appreciate your thoughts.

I suspect that what I want is one of the DVC (DataViewCtrl) widgets or a

list control. What criteria do I apply to decide which might be the most

appropriate for entering (and editing) variable types of data?

Pointers to example applications using these widgets would be nice.

TIA,

Rich

Che,

   Thanks. Considering that example was written last autumn I'm surprised he
uses wx.PySimpleApp() as that's been deprecated.

   I'll be using SQLAlchemy between the UI and the backend database so it
seems that wx.Grid() is the way to go. I can put a grid on the panel rather
than the wx.TextCtrl() and wx.ComboBox() widgets. Perhaps I can even put a
choice or combobox in a cell when there's a limited and defined list of
valid entries for that column. Think there's sample code on the Wiki site.

   Then all I need are Add/Edit/Deactivate buttons for each page, and those
can be in a separate class and called with pubsub.

Thanks,

Rich

···

On Tue, 24 Feb 2015, C M wrote:

Offhand, it seems like they all do about the same thing relative to your
needs: show rows and column headers. I tend to think in terms of grids
when browsing databases (such as with SQLite Database Browser), so then I
guess wxGrid would be good, and found this write-up about using it with an
SQLite database:
http://www.salstat.com/news/linking-wxgrid-to-sqlite-database-in-python-an-example

I actually tend to use ObjectListView, a wrapper for wx.ListCtrl to work with databases. But I also like to use SQLAlchemy which has classes that are similar to the ones I use in ObjectListView. Anyway, here’s a link to a tutorial I did on the subject a while ago:

ObjectListView can be found here: ObjectListView — ObjectListView 1.3 documentation

  • Mike
···

On Tuesday, February 24, 2015 at 4:42:15 PM UTC-6, fuzzydoc wrote:

After spending a lot of time creating a notebook with nested pages each

holding a variable number of data entry widgets I now realize that this is

not the correct approach. The notebook with nested pages will work well, but

what’s really needed is a widget that displays all rows in the backend

database table. There are several in the wxPython-3.0.0.0 and since I’ve no

experience with any of them I’d appreciate your thoughts.

I suspect that what I want is one of the DVC (DataViewCtrl) widgets or a

list control. What criteria do I apply to decide which might be the most

appropriate for entering (and editing) variable types of data?

Pointers to example applications using these widgets would be nice.

TIA,

Rich

Mike,

   I've read your tutorial ... several times. If I understand it, both OLV
and SA are compatible. Not sure if OLV is limited to a single table column
or can display entire table rows. I'll look again, but today other projects
have priority.

   The application supports my environmental consulting business, but is not
the focus of my business so learning the most expeditious and robust way to
structure the application is taking time.

Thanks very much,

Rich

···

On Wed, 25 Feb 2015, Mike Driscoll wrote:

I actually tend to use ObjectListView, a wrapper for wx.ListCtrl to work
with databases. But I also like to use SQLAlchemy which has classes that
are similar to the ones I use in ObjectListView. Anyway, here's a link to
a tutorial I did on the subject a while ago:

http://www.blog.pythonlibrary.org/2011/11/10/wxpython-and-sqlalchemy-an-intro-to-mvc-and-crud/

ObjectListView can be found here:
ObjectListView — ObjectListView 1.3 documentation

It can easily display multiple columns and rows. I wrote this fun little tutorial to demonstrate how flexible it is:

This should open most SQLite databases. I think I ran into a few oddballs with some of Firefox’s examples, but it worked for everything else I tested it with.

  • Mike
···

On Wednesday, February 25, 2015 at 8:23:18 AM UTC-6, fuzzydoc wrote:

On Wed, 25 Feb 2015, Mike Driscoll wrote:

I actually tend to use ObjectListView, a wrapper for wx.ListCtrl to work

with databases. But I also like to use SQLAlchemy which has classes that

are similar to the ones I use in ObjectListView. Anyway, here’s a link to

a tutorial I did on the subject a while ago:

http://www.blog.pythonlibrary.org/2011/11/10/wxpython-and-sqlalchemy-an-intro-to-mvc-and-crud/

ObjectListView can be found here:

http://objectlistview-python-edition.readthedocs.org/en/latest/

Mike,

I’ve read your tutorial … several times. If I understand it, both OLV

and SA are compatible. Not sure if OLV is limited to a single table column

or can display entire table rows. I’ll look again, but today other projects

have priority.

Mike,

   Thanks! I'll be sure to read it.

   After I get the SQLite version up and running I hope to just change the
back-end to postgres in SA and have a multi-user/client-server running.

Regards,

Rich

···

On Wed, 25 Feb 2015, Mike Driscoll wrote:

It can easily display multiple columns and rows. I wrote this fun little
tutorial to demonstrate how flexible it is:

http://www.blog.pythonlibrary.org/2012/06/04/wxpython-and-sqlalchemy-loading-random-sqlite-databases-for-viewing/

This should open most SQLite databases. I think I ran into a few oddballs
with some of Firefox's examples, but it worked for everything else I
tested it with.

...

Mike,

  I've read your tutorial ... several times. If I understand it, both OLV
and SA are compatible. Not sure if OLV is limited to a single table
column
or can display entire table rows.

Can have multiple rows, rows can even come from related tables.

Thought we had an example on how to do related tables but it doesn't look like it.

Werner

···

On 2/25/2015 15:23, Rich Shepard wrote:

On Wed, 25 Feb 2015, Mike Driscoll wrote:

--

Niderenweg 6
CH-9043 Trogen

Tel: +41 71 340 06 30
Mob: +41 76 374 81 07

in medialocker

Werner

···

On 2/25/2015 16:58, Werner wrote:

On 2/25/2015 15:23, Rich Shepard wrote:

On Wed, 25 Feb 2015, Mike Driscoll wrote:

...

Mike,

  I've read your tutorial ... several times. If I understand it, both OLV
and SA are compatible. Not sure if OLV is limited to a single table
column
or can display entire table rows.

Can have multiple rows, rows can even come from related tables.

Thought we had an example on how to do related tables but it doesn't look like it.

Werner,

   Thanks, again!

Rich

···

On Wed, 25 Feb 2015, Werner wrote:

Can have multiple rows, rows can even come from related tables. Thought we
had an example on how to do related tables but it doesn't look like it.