wxpython strange behaviour

Shiva Upreti katewinslet626 at gmail.com
Fri Jan 15 19:52:18 EST 2016


On Friday, January 15, 2016 at 10:55:59 PM UTC+5:30, Ian wrote:
> On Fri, Jan 15, 2016 at 10:05 AM, Shiva Upreti <katewinslet626 at gmail.com> wrote:
> > https://gist.github.com/anonymous/4baa67aafd04555eb4e6
> >
> > I wrote the above code to display a toasterbox, and I didnt want it to display any frames on the screen, just a toasterbox. The problem with this code is that it runs fine when I run it the first time, but when I run it next time it shows some error and the toasterbox doesnt disappear from the screen itself(it should though).
> > Error message I got:
> > https://gist.github.com/anonymous/f0d4ec685d2432c80a1
> 
> The first gist is short enough that it easily could have been included
> inline in your message. The second gist is a 404 (looks like it may be
> short one hex digit).
> 
> I haven't used wxPython in a while and I've never used that ToasterBox
> widget, but I'll see what I can answer.
> 
> If you don't want any frames then you should probably use parent=None,
> not parent=wx.Frame(None), which creates a frame. Also, the purpose of
> the panel is unclear since it's never used.
> 
> When you say that you run it the next time, do you mean that you're
> running this script twice, as two separate processes, and getting
> different results? That seems strange. Or do you mean that you're
> invoking this code multiple times in the same Python process?

parent=None doesnt work, it gives error:
<code>
AttributeError                            Traceback (most recent call last)
C:\Users\Mike\Desktop\zz.py in <module>()
      5 app = wx.App()
      6 panel=wx.Panel(parent=wx.Frame(None))
----> 7 toaster = TB.ToasterBox(parent=None, tbstyle=TB.TB_COMPLEX, closingstyle=TB.TB_ONTIME)
      8 
      9 toaster.SetPopupPauseTime(3000)

C:\Users\Mike\AppData\Local\Enthought\Canopy\User\lib\site-packages\wx\lib\agw\toasterbox.pyc in __init__(self, parent, tbstyle, windowstyle, closingstyle, scrollType)
    135                                     wx.GetDisplaySize().GetHeight())
    136 
--> 137        parent.Bind(wx.EVT_ICONIZE, lambda evt: [w.Hide() for w in winlist])
    138 
    139        self._tb = ToasterBoxWindow(self._parent, self, self._tbstyle, self._windowstyle,

AttributeError: 'NoneType' object has no attribute 'Bind'
</code>



More information about the Python-list mailing list