Re: [wxpython-users] newbie with some questions
by Mike Driscoll other posts by this author
May 9 2008 7:06AM messages near this date
[wxpython-users] newbie with some questions
|
[wxpython-users] Inserting a BitMap into a Sizer
Tim,
> Hello,
>
> I am new to wxPython, & it's the first GUI tool i've ever used.
> (although i've been sniffing around this vicinity once or twice before
> without making much progress...)
>
> I started teaching myself Python circa June 2007, primarily to work
> with Csound to make "ambient", "experimental", &/or "generative" types
> of music.
>
> I now wish to use wxPython to start developing some GUI / front ends
> for my ideas.
>
> I have the "wx In Action" book & i have found it very helpful. Thank
> you to the authors.
>
> I have also been poking around with wxGlade over the last couple of days.
>
> I have some questions that haven't been answered through using the wx
> In Action book, & also as a result of looking through the wxPython
> demo application.
>
> Primarily they are
>
> 1) How can i add more than one Grid into a split wxFrame?
>
> wxGlade allows me to do so, & publishes a preview ok. However the
> example of this I have attached (admittedly with only 1 Grid, but the
> principle is the same) won't run as a standalone script on my windows
> XP machine.
>
> It's the whole attaching Grid to a host Frame as "self" thing (see
> line 22 of the example code)... how can this be done (if wxGlade can
> preview it ok, then surely somehow it is possible?)
You should be able to do this by creating two grids and then adding them
to sizers. I'm not sure what you mean by a split wx.Frame though. Are
you talking about a splitter window? If so, then you'd put one grid in
one panel and the other grid in the other panel.
>
> 2) I'm a little nervous because in the wxPython demo app for Grid it says
>
> "This demo shows various ways of using the new and improved wx.Grid
> class. Unfortunatly it has not been documented yet, and while it is
> somewhat backwards compatible, if you try to go by the current wx.Grid
> documentation you will probably just confuse yourself. "
>
> Assumedly then this is also true vis a vis the information in the wx
> In Action book then also?
> What's a generally befuddled novitiate like me therefore to do? Most
> of what i have tried with the Grid by way of the book examples seems
> to work after all...
I use the book all the time and it seems to be right on for everything
I've done. My guess is that it's referring to stuff I don't use...
>
> 3) Can someone show me in a general way (or link me appropriately,
> this must be asked all the time...) how to conditionally redraw &
> refresh the interface with widgets?
>
> For example, lets say i have a list box, with available selections
> 1,2,3, or 4
>
> The selection is evaluated, & based on this i'd like to repopulate the
> Panel & have that many checkboxes (for example) displayed
>
> I actually want to take this one step further & define my own custom
> row of checkboxes (assumedly as a Class "MyCustomCheckList")
>
> x x x x x x x
>
> & then populate the screen with this many rows of the CustomCheckList
>
> eg:
>
> selection : 3
>
> display:
>
> x x x x x x x
> x x x x x x x
> x x x x x x x
>
> (3 rows of CustomCheckList objects)
>
> I'm sure some simple "for n in range(selection)" type statements can
> deliver the goods, but is there any special threading or refresh
> display calls required to redraw the GUI to the screen?
This can be done in lots of different ways. In your event handler, you
can show/hide pre-made panels. Or you can show/hide rows of checkboxes
in your sizers. See the sizer docs for more info, particularly the
Detach(), Show() and Remove() methods:
http://www.wxpython.org/docs/api/wx.Sizer-class.html
You'll probably want to use the Layout() and/or Refresh() commands when
you get done showing/hiding your widgets to make it resize appropriately
too.
>
> Of course, if I can get one or more Grids happening in a split frame,
> then I can assumedly just re-label (&/or reformat) the rows of the
> grid to reflect "this row active", & use checkboxes as cell types to
> get the same overall effect. But then we are back to point 1) above
>
> Im looking forward to getting my hands dirty, & i'd welcome any
> assistance to hit the ground running.
>
> cheers
>
> Tim (Adelaide, Australia - if you are local & keen to chat Python &/or
> wx please get in touch!)
>
As I recall, the demo or the book has examples of creating checkboxes or
buttons dynamically. You might check the demo or that section(s) of the
book.
Mike
_______________________________________________
wxpython-users mailing list
wxpython-users@[...].org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
Thread:
Tim Mortimer
Mike Driscoll
|