help my status bar launch message error

hi i trying to use statusbar in my app with ok here es the code

def OnSize....

def CreateStBar(self):
        self.stbar = wx.StatusBar(self, -1)

        self.stbar.SetFieldsCount(8)
        self.stbar.SetStatusText("Ready", 0)
        self.stbar.SetStatusWidths([-2, -1, -1, -1, -1, -1, -1, -2])

        self.SetStatusBar(self.stbar)

        self.col = wx.StaticText(self.stbar, -1, "Col",
wx.DefaultPosition, wx.DefaultSize)
        self.line = wx.StaticText(self.stbar, -1, "Line",
wx.DefaultPosition, wx.DefaultSize)
        self.stxt = wx.StaticText(self.stbar, -1,
"file"+self.filename, wx.DefaultPosition, wx.DefaultSize)
        self.grun = wx.Gauge(self.stbar, -1)

        self.Reposition()

    def Reposition(self):
        crect = self.stbar.GetFieldRect(1)
        self.col.SetPosition((crect.x+2, crect.y+2))
        self.col.SetSize((crect.width-4, crect.height-4))

        lrect = self.stbar.GetFieldRect(2)
        self.line.SetPosition((lrect.x+15, lrect.y+2))
        self.line.SetSize((lrect.width-15, lrect.height-4))

        srect = self.stbar.GetFieldRect(3)
        self.stxt.SetPosition((srect.x+15, srect.y+2))
        self.stxt.SetSize((srect.width-15, srect.height-4))

        grect = self.stbar.GetFieldRect(7)
        self.grun.SetPosition((grect.x+2, grect.y+2))
        self.grun.SetSize((grect.width-4, grect.height-4))

        self.sizechanged = False

and here is the error

Traceback (most recent call last):
  File "C:\Users\ozkar\Dropbox\script\main.py", line 77, in OnSize
    self.Reposition()
  File "C:\Users\ozkar\Dropbox\script\main.py", line 97, in Reposition
    crect = self.stbar.GetFieldRect(1)
AttributeError: 'Frame' object has no attribute 'stbar'

I Don't know whats wronw here

i have other application with the same code and it runs perfect

It looks like you are launching Reposition() somewhere else before you launch CreateStBar() but i cant say it for 100% because i cant see the whole code.
It will be much easier when you add a launchable Sample.

Greets
Alex

iozk_Live wrote:

hi i trying to use statusbar in my app with ok here es the code
...
and here is the error

Traceback (most recent call last):
  File "C:\Users\ozkar\Dropbox\script\main.py", line 77, in OnSize
    self.Reposition()
  File "C:\Users\ozkar\Dropbox\script\main.py", line 97, in Reposition
    crect = self.stbar.GetFieldRect(1)
AttributeError: 'Frame' object has no attribute 'stbar'

I Don't know whats wronw here

Alex nailed it. The traceback shows that Reposition is being called
from OnSize, which is apparently being called before CreateStBar.

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

oh thanks! I solved it, the Bind of OnSize were called before the
self.CreateStBar(), I've changed after this statement and runs great.

I must review the sintax of python, again

Thanks again!

···

On 30 sep, 12:34, Tim Roberts <t...@probo.com> wrote:

iozk_Live wrote:
> hi i trying to use statusbar in my app with ok here es the code
> ...
> and here is the error

> Traceback (most recent call last):
> File "C:\Users\ozkar\Dropbox\script\main.py", line 77, in OnSize
> self.Reposition()
> File "C:\Users\ozkar\Dropbox\script\main.py", line 97, in Reposition
> crect = self.stbar.GetFieldRect(1)
> AttributeError: 'Frame' object has no attribute 'stbar'

> I Don't know whats wronw here

Alex nailed it. The traceback shows that Reposition is being called
from OnSize, which is apparently being called before CreateStBar.

--
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.