Font error leading to a timer error?

Hi,
I think that you need to out-dent your return statement - otherwise
if the if statement is true you return Nothing if false then you
return a font family.
This might have some bearing.
Gadget/Steve

···

On 27/05/13 00:10, Kavitha Bhaskaran
wrote:

  I was running into a font error earlier in which was being shown

in_gdi.py (failure point)

  In customtreectrl.py, **family** had a value 74. I saw some

threads where it said that it was a wx.Font bug and that it should
return FONTFAMILY_DEFAULT instead… which is why i added the else
condition below…

   if family == wx.FONTFAMILY_UNKNOWN:

              print "inside family condition"

              family = wx.FONTFAMILY_SWISS

          else:  #Else condition added by KB

              print "inside else family condition"

              family = wx.FONTFAMILY_DEFAULT  #KB

              return family



  After adding the else condition in customtreectrl.py in

wx/lib/agw, the font error does not come up but another error

  typeerror in method new_Timer expected argument of type

wxEvtHandler. (failure point is _misc.py) . I dont know if I am
landing on the right error after resolving the previous one or is
it just random?

  If you feel I have landed on error 2 validly from error 1, that i

had… pls let me know if i m on the right track.

  Any suggestions?

  --

  You received this message because you are subscribed to the Google

Groups “wxPython-users” group.

  To unsubscribe from this group and stop receiving emails from it,

send an email to .
For more options, visit .


Steve Gadget Barnes

wxpython-users+unsubscribe@googlegroups.com
https://groups.google.com/groups/opt_out

return

should be

return

As it stands, I don’t see how it can return anything. (Maybe I’m missing something?)

···

On Mon, May 27, 2013 at 10:05 AM, Kavitha Bhaskaran kukki.kanchana@gmail.com wrote:

Hi Steve:

Yes, I realized that:

Changed it to

if family == wx.FONTFAMILY_UNKNOWN:

        print "inside family condition"
        family = wx.FONTFAMILY_SWISS
    else:  #Else condition added by KB
        print "inside else family condition"
        family = wx.FONTFAMILY_DEFAULT

    return family

and I still run into the timer error!

I think you have larger indentation issues than that, actually - it’s hard to know whether the issue is in your code, or whether it’s an email formatting problem, but I think that your structure

if:

    stuff

else:

    stuff

if:

stuff

else:

stuff

Hi Marc:

It is really the indentation in the email. Additionally, I accidentally was returning something… the return should not be present there at all as the code has to proceed.

My issue is that “family” has a value 74 and wx.FONTFAMILY_UNKNOWN has value 77.

I added the else condition in this wx/lib/agw/customtreectrl.py file, based on https://groups.google.com/forum/?fromgroups#!topic/wxPython-dev/9al_nta49no thread number 17.

print “family is”, family
print “wx.FONTFAMILY_UNKNOWN is”, wx.FONTFAMILY_UNKNOWN
if family == wx.FONTFAMILY_UNKNOWN:
print “inside if condition”
family = wx.FONTFAMILY_SWISS
else: #Else condition added by KB
print “inside else condition”
family = wx.FONTFAMILY_DEFAULT
val = self._normalFont.GetPointSize()
print “val is”, val
self._boldFont = wx.Font(self._normalFont.GetPointSize(), family,
self._normalFont.GetStyle(), wx.BOLD, self._normalFont.GetUnderlined(),
self._normalFont.GetFaceName(), self._normalFont.GetEncoding())
self._italicFont = wx.Font(self._normalFont.GetPointSize(), family,
wx.FONTSTYLE_ITALIC, wx.NORMAL, self._normalFont.GetUnderlined(),
self._normalFont.GetFaceName(), self._normalFont.GetEncoding())

    # Hyperlinks things
    self._hypertextfont = wx.Font(self._normalFont.GetPointSize(), family,
                                  self._normalFont.GetStyle(), wx.NORMAL, True,
                                  self._normalFont.GetFaceName(), self._normalFont.GetEncoding())
    self._hypertextnewcolour = wx.BLUE
    self._hypertextvisitedcolour = wx.Colour(200, 47, 200)

I run into "Exception – PyAssertionError:C++ assertion “Ok()” failed at …..\src\msw\font.cpp (1024) in wxFont::GetPointSize():invalid font.

Would someone please be able to tell me where i could find font.cpp? I cant find it in my local folders!

Any suggestions will be appreciated to get me on the right track!

···

On Monday, May 27, 2013 11:09:05 AM UTC-7, Marc wrote:

On Mon, May 27, 2013 at 10:05 AM, Kavitha Bhaskaran kukki.k...@gmail.com wrote:

Hi Steve:

Yes, I realized that:

Changed it to

if family == wx.FONTFAMILY_UNKNOWN:

        print "inside family condition"
        family = wx.FONTFAMILY_SWISS
    else:  #Else condition added by KB
        print "inside else family condition"
        family = wx.FONTFAMILY_DEFAULT

    return family

and I still run into the timer error!

I think you have larger indentation issues than that, actually - it’s hard to know whether the issue is in your code, or whether it’s an email formatting problem, but I think that your structure

if:

    stuff
else:
    stuff
return

should be

if:

stuff

else:

stuff

return

As it stands, I don’t see how it can return anything. (Maybe I’m missing something?)

Could you re-post this, either with formatting turned off or in a
monospaced font? The indentation and line wrapping are so messed up that I
for one can't make any sense of it as it stands.

···

On Mon, May 27, 2013 at 11:18 AM, Kavitha Bhaskaran < kukki.kanchana@gmail.com> wrote:

Hi Marc:

It is really the indentation in the email.

Which call to GetPointSize() is failing? I see you're putting in print
statements to help you trace your progress (excellent!) - so where are you
when things go wrong? In other words, what's the last thing that prints
before the error?

I don't think your error will end up being in font.cpp; it will be that you
don't actually have a valid font object when you make the call.

···

On Mon, May 27, 2013 at 11:18 AM, Kavitha Bhaskaran < kukki.kanchana@gmail.com> wrote:

I run into "Exception -- PyAssertionError:C++ assertion "Ok()" failed at
..\..\src\msw\font.cpp (1024) in wxFont::GetPointSize():invalid font.

font.cpp is C++, I doubt that the problem is in there.
Look at the exception and “go up” the traceback until you see a line
in your code and check that line with e.g. a debugger and make sure
that you have a valid font.
e.g. is “self._normalFont” always a valid font when you use it?
Werner

···

Hi,

  On 27/05/2013 20:18, Kavitha Bhaskaran wrote:

Hi Marc:

  It is really the indentation in the email. Additionally, I

accidentally was returning something… the return should not be
present there at all as the code has to proceed.

  My issue is that "family" has a value 74 and wx.FONTFAMILY_UNKNOWN

has value 77.

  I added the else condition in this wx/lib/agw/customtreectrl.py

file, based on
https://groups.google.com/forum/?fromgroups#!topic/wxPython-dev/9al_nta49no

thread number 17.

  print "family is", family

          print "wx.FONTFAMILY_UNKNOWN is", wx.FONTFAMILY_UNKNOWN

          if family == wx.FONTFAMILY_UNKNOWN:

              print "inside if condition"

              family = wx.FONTFAMILY_SWISS

          else: #Else condition added by KB

              print "inside else condition"

              family = wx.FONTFAMILY_DEFAULT

              val = self._normalFont.GetPointSize()

              print "val is", val

          self._boldFont = wx.Font(self._normalFont.GetPointSize(),

family,

                                   self._normalFont.GetStyle(),

wx.BOLD, self._normalFont.GetUnderlined(),

                                   self._normalFont.GetFaceName(),

self._normalFont.GetEncoding())

          self._italicFont =

wx.Font(self._normalFont.GetPointSize(), family,

                                     wx.FONTSTYLE_ITALIC, wx.NORMAL,

self._normalFont.GetUnderlined(),

                                     self._normalFont.GetFaceName(),

self._normalFont.GetEncoding())

          # Hyperlinks things

          self._hypertextfont =

wx.Font(self._normalFont.GetPointSize(), family,

                                        self._normalFont.GetStyle(),

wx.NORMAL, True,

self._normalFont.GetFaceName(), self._normalFont.GetEncoding())

          self._hypertextnewcolour = wx.BLUE

          self._hypertextvisitedcolour = wx.Colour(200, 47, 200)



  I run into "Exception -- PyAssertionError:C++ assertion "Ok()"

failed at …..\src\msw\font.cpp (1024) in
wxFont::GetPointSize():invalid font.

  Would someone please be able to tell me where i could find

font.cpp? I cant find it in my local folders!

Kavitha Bhaskaran wrote:

Hi Marc:

It is really the indentation in the email. Additionally, I accidentally
was returning something.. the return should not be present there at all
as the code has to proceed.

My issue is that "family" has a value 74 and wx.FONTFAMILY_UNKNOWN has
value 77.

I added the else condition in this wx/lib/agw/customtreectrl.py file,
based
onhttps://groups.google.com/forum/?fromgroups#!topic/wxPython-dev/9al_nta49no
thread number 17.

Have you tried using the latest version of the AGW code? You can get it from SVN at http://svn.wxwidgets.org/svn/wx/wxPython/3rdParty/AGW/.

If that doesn't help then please make a runnable, small as possible, sample application that demonstrates the problem. MakingSampleApps - wxPyWiki

···

--
Robin Dunn
Software Craftsman