python - Getting strange results from wxPython WebView -


i'm making huffington post rss feed aggregator in wxpython, i've run trouble. in program there 2 panels in main wx.frame: 1 shows list of articles , other show web view of article user selects. haven't gotten part yet, decided test web view widget loading google. when this, i'm getting strange results. here relevant code:

hbox = wx.boxsizer(wx.horizontal)  listpanel = wx.panel(self, -1, style=wx.sunken_border) htmlpanel = wx.panel(self, -1, style=wx.sunken_border)  browser = wx.html2.webview.new(htmlpanel) browser.loadurl("http://www.google.com")  hbox.add(listpanel, 1, wx.expand) hbox.add(htmlpanel, 2, wx.expand)  self.setautolayout(true) self.setsizer(hbox) self.layout() 

and here picture of get:

http://i.imgur.com/tvukzre.png

i seem text box in upper left corner, possibly google search box? no clue or why i'm getting this. if happens see i've gone wrong, appreciate help.

edit:

here runnable code shows problem:

import wx import wx.html2  class mainframe(wx.frame):      def __init__(self, *args, **kwargs):         super(mainframe, self).__init__(*args, **kwargs)         self.initui()         self.centre()         self.show()      def initui(self):         hbox = wx.boxsizer(wx.horizontal)          listpanel = wx.panel(self, -1, style=wx.sunken_border) #this panel news articles shown         htmlpanel = wx.panel(self, -1, style=wx.sunken_border) #this panel web view shown          browser = wx.html2.webview.new(htmlpanel) #i create new web view here htmlpanel parent         browser.loadurl("http://www.google.com") #and load google here          hbox.add(listpanel, 1, wx.expand) #then add both panels frame. not sure went wrong.         hbox.add(htmlpanel, 2, wx.expand)          self.setautolayout(true)         self.setsizer(hbox)         self.layout()  def main():     app = wx.app()     frame = mainframe(none, title='what box? help!', size=(800,480))     app.mainloop()   if __name__ == '__main__':     main() 

the reason code doesn't work because webview widget isn't in sizer of own. doesn't know expand. if add sizer, works. see below:

import wx import wx.html2  class mainframe(wx.frame):      def __init__(self, *args, **kwargs):         super(mainframe, self).__init__(*args, **kwargs)         self.initui()         self.centre()         self.show()      def initui(self):         hbox = wx.boxsizer(wx.horizontal)         htmlsizer = wx.boxsizer(wx.vertical)          listpanel = wx.panel(self, -1, style=wx.sunken_border) #this panel news articles shown         htmlpanel = wx.panel(self, -1, style=wx.sunken_border) #this panel web view shown          browser = wx.html2.webview.new(htmlpanel) #i create new web view here htmlpanel parent         browser.loadurl("http://www.google.com") #and load google here         htmlsizer.add(browser, 1, wx.expand)         htmlpanel.setsizer(htmlsizer)          hbox.add(listpanel, 1, wx.expand) #then add both panels frame. not sure went wrong.         hbox.add(htmlpanel, 2, wx.expand)          self.setautolayout(true)         self.setsizer(hbox)         self.layout()  def main():     app = wx.app()     frame = mainframe(none, title='what box? help!', size=(800,480))     app.mainloop()   if __name__ == '__main__':     main() 

Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -