[wxPython-users] wx.html.HtmlWindow and wxpTag, how to fetch all user input at once ?

Robin Dunn robin at alldunn.com
Wed Jan 2 16:59:28 PST 2008


Stef Mientki wrote:
> hello,
> 
> I've a html page with embedded wx-controls,
> through wxp tags.
> I show these pages in wx.html.HtmlWindow,
> which works very nice.
> 
> On these pages there are several controls, like a few wx.TextCtrl.
> Now what ever the user puts into these controls,
> I want to grab that in one time,
> preferable without extra user interaction, so for instance when the user 
> leaves the page.
> 
> Now I saw a previous question in the list related to my question,
> about retrieving a checkbox.
> 
> <wxp module="wx" class="CheckBox">
>    <param name="label" value=I>    <param name="id" value=5100>
> </wxp>
> 
> checkbox=myhtmlwin.FindWindowById(5100)
> 
> But that's not  a very elegant way,
> certainly if you don't know the content of the page at forehand ;-)
> 
> So the questions are:
> - is there a way to find all wxp controls on a page (other than parsing 
> the source string ;-) ?


theHtmlWindow.GetChildren() will return a sequence of the child widgets 
of the window.  You can iterate through that sequence and grab the 
values or nearly whatever else you want to do.


> - if these controls can be found, can I get to know there type ?

You can look at child.__class__ or use isinstance()


> - I can detect leaving the page from some button presses,
> but is there a way to get notified when the page is left ?

Not directly, but you can catch the link clicked events to know when the 
page is being left by some means other than your buttons.


-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!




More information about the wxpython-users mailing list