FW: When error "wx._core.PyAssertionError: C++ assertion "hFont" failed" occur?

failed" occur?

Mukul,

Please do not reply to me directly, you are supposed to post the mailing
list
address: wxpython-users@googlegroups.com

Regards,

···

-----Original Message-----
From: AWainb [mailto:awainb@gmail.com]
Sent: September-19-10 12:22 PM
To: 'mukul'
Subject: RE: When error "wx._core.PyAssertionError: C++ assertion "hFont"

-----Original Message-----
From: mukul [mailto:meet2mukul@gmail.com]
Sent: September-19-10 6:44 AM
To: AWainb
Subject: Re: When error "wx._core.PyAssertionError: C++ assertion "hFont"
failed" occur?

Hi Awainb,

the example i gave just to simulate the problem.
Actually in my app there is load profile options (which give the info
about how many and what type of widgets should be created).
so two profile can have different widgets type and numbers.
so it is required when you load a different profile, you have to
delete/destroy all the child of the panel of existing profile and
create new widgets define in new profile.

That i am getting that error.

On Sep 18, 11:26 pm, "AWainb" <awa...@gmail.com> wrote:

Hey mukul,

What kind of controls are the children?

Why are you destroying the children and then resetting them when you can
just clear the controls instead?

All I can gather from the little bit of information you provided is that
your overall goal is to clear the current data from the controls when
"Reload" is pushed. If this assumption is correct, then I would suggest

you

create a function that will reset all of your controls values when Reload

is

clicked. Most, if not all, controls have some sort of method to clear

their

value(s). Here's a couple of examples:

    \- TextCtrl:             Clear\(\), ChangeValue\(\), SetValue\(\),

WriteText(), etc.
- StaticText: SetLabel()
- ListCtrl: ClearAll(), DeleteAllColumns(),
DeleteAllItems(), DeleteColumn(), DeleteItem(), etc.

    self\.myTextCtrl = wx\.TextCtrl\(self, \-1, &quot;Current Value&quot;\)
    self\.myStaticText = wx\.StaticText\(self, \-1, &quot;Current Label&quot;\)

    self\.ClearCtrls\(\)

  def ClearCtrls\(self\):
        \#will blank/reset the control
        self\.myTextCtrl\.Clear\(\)
        self\.myStaticText\.SetLabel\(&quot;&quot;\)

I would have been more specific but you have not given us enough info to
work with. Best to take a look at the individual docs for each control you
are using, Try:

http://www.wxpython.org/docs/api/wx-module.htmlorhttp://www.wxpython.org/onl
inedocs.php

Some sample code would be helpful...

Regards,

-----Original Message-----
From: wxpython-users@googlegroups.com

[mailto:wxpython-users@googlegroups.com] On Behalf Of mukul
Sent: September-18-10 7:24 AM
To: wxPython-users
Subject: [wxPython-users] When error "wx._core.PyAssertionError: C++
assertion "hFont" failed" occur?

Hi All,

In my app I am putting some wxWidget on a panel (child of frame).
There are two option buttons available like load and reload(reload
will enable after once load happen).
Once you press on load button this will load/create all the wxWidget
on the panel.
Once you reload the button it will delete/destroy all children of the
panel by panel.DestroyChildren() method and load ie create all the
wxWidget again.

But while reloading the wxWidgets i am getting the following error in
the the __init__method of of the wxWidgets.
like "wx._core.PyAssertionError: C++ assertion "hFont" failed at ..\..
\src\msw\window.
cpp(820) in wxWindow::SetFont(): should have valid font".

Any guess where it can go wrong.

Because in the whole destroying children process i am not deleting or
using font anywhere.
If some font error is there then why i doesn't appear while creating
wxWidget first time.

Thanks .

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visithttp://groups.google.com/group/wxPython-users?hl=en