Thaw failure despite IsFrozen returning True

As you all may have seen in the wxPython demo failure thread of the
past two days, I’m using the January 4th 3.0.1.0 beta version of
wxPython (available here: ), because the December 25th 3.0.0.0 production version caused the
wxPython 3.0.0.0 demo to fail. I’m using wxPython with Python 2.7.6
on my Windows XP SP3 machine.
But now I’m seeing supposedly-impossible Thaw failures. Here’s an
example, where I’m using a simple Notebook:
This traceback results:
Might this “impossible” result be occurring simply because I’m using
a beta version of wxPython? Since I can’t use version 3.0.0.0,
should I be using August 31st’s 2.9.5.0 version instead? (I
recently upgraded from version 2.8.10.1.)
Bob
P.S. Just in case anyone might ask: I cannot produce a small,
runnable example of this behavior.

···

http://wxpython.kosoftworks.com/preview/20140104/
if frame.nb1.IsFrozen(): frame.nb1.Thaw()
** File “C:\Python27\lib\site-packages\wx-3.0-msw\wx_core.py”, line
10746, in Thaw** return core.Window_Thaw(*args, **kwargs) ** wx._core.PyAssertionError: C++ assertion “m_freezeCount”
failed at …\src\common\wincmn.cpp(1257) in
wxWindowBase::Thaw(): Thaw() without matching Freeze()**

I'm quite surprised that no one has had anything to say about this single-statement failure. Hence the repost.

Bob

···

On 3/31/2014 8:11 AM, Bob Klahn wrote:

As you all may have seen in the wxPython demo failure thread of the past two days, I'm using the January 4th 3.0.1.0 beta version of wxPython (available here: http://wxpython.kosoftworks.com/preview/20140104/ ), because the December 25th 3.0.0.0 production version caused the wxPython 3.0.0.0 demo to fail. I'm using wxPython with Python 2.7.6 on my Windows XP SP3 machine.

But now I'm seeing supposedly-impossible Thaw failures. Here's an example, where I'm using a simple Notebook:

* if frame.nb1.IsFrozen(): frame.nb1.Thaw()**
*
This traceback results:

*File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 10746, in Thaw**
** return _core_.Window_Thaw(*args, **kwargs)**
**wx._core.PyAssertionError: C++ assertion "m_freezeCount" failed at ..\..\src\common\wincmn.cpp(1257) in wxWindowBase::Thaw(): Thaw() without matching Freeze()**
*
Might this "impossible" result be occurring simply because I'm using a beta version of wxPython? Since I can't use version 3.0.0.0, should I be using August 31st's 2.9.5.0 version instead? (I recently upgraded from version 2.8.10.1.)

Bob

P.S. Just in case anyone might ask: I cannot produce a small, runnable example of this behavior.

Are you sure that error refers to the line in bold above? Is there no other .Thaw() line in your code? I ask because you are not getting the error if you make a small runnable sample.

And do you not get this error with the exact same code run on an earlier version of wxPython?

···

On Thu, Apr 3, 2014 at 7:21 AM, Bob Klahn bobstones@comcast.net wrote:

  I'm quite surprised that no one has had

anything to say about this single-statement failure. Hence the
repost.

  Bob




  On 3/31/2014 8:11 AM, Bob Klahn wrote:
  As you all may have seen in the wxPython demo failure thread of

the past two days, I’m using the January 4th 3.0.1.0 beta version
of wxPython (available here: http://wxpython.kosoftworks.com/preview/20140104/
), because the December 25th 3.0.0.0 production version caused the
wxPython 3.0.0.0 demo to fail. I’m using wxPython with Python
2.7.6 on my Windows XP SP3 machine.

  But now I'm seeing supposedly-impossible Thaw failures.  Here's an

example, where I’m using a simple Notebook:

  **if frame.nb1.IsFrozen(): frame.nb1.Thaw()**
  This traceback results:

  **        File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py",

line 10746, in Thaw** return core.Window_Thaw(*args, **kwargs) ** wx._core.PyAssertionError: C++ assertion “m_freezeCount”
failed at …..\src\common\wincmn.cpp(1257) in
wxWindowBase::Thaw(): Thaw() without matching Freeze()**

  Might this "impossible" result be occurring simply because I'm

using a beta version of wxPython? Since I can’t use version
3.0.0.0, should I be using August 31st’s 2.9.5.0 version instead?
(I recently upgraded from version 2.8.10.1.)

  Bob



  P.S. Just in case anyone might ask:  I cannot produce a small,

runnable example of this behavior.

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 wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Any time I find that I can't make a small, runnable sample of a problem in
one of my programs, I assume that the problem is in my code, and not in wx.
The way I usually work from there on is to make fancier versions of the
working example, and simpler versions of the problem code, until they meet
somewhere. That is usually enough to isolate the real problem, which can
often be quite surprising. Good luck, and be resolute.

···

On Thu, Apr 3, 2014 at 7:21 AM, Bob Klahn <bobstones@comcast.net> wrote:

I'm quite surprised that no one has had anything to say about this
single-statement failure. Hence the repost.

--
Best Regards,
Michael Moriarity

This may help someone ...

I have at last solved the Thaw-failure problems I recently experienced after upgrading Python from 2.5 to 2.7.6 and wxPython from 2.8.10.1 to beta 3.0.1.0. What a relief! I did so by replacing all direct calls to *Freeze()* and *Thaw()* with calls to this code, placed in a separate module:

*winWarmth = {}**

···

**
**def winWarmthLookup(win):**
** # Check to see if we have already frozen or**
** # thawed this window or any of its parents**
** w = win**
** handle = win.GetHandle()**
** level = 0**
** found = False**
** while not found:**
** if w is not None: break**
** handle = w.GetHandle()**
** found = handle in winWarmth**
** if not found:**
** w = w.GetParent()**
** level += 1**
** return w, handle, level, found**
**
**def Freeze( win, source ):**
** w, handle, level, found = winWarmthLookup(win)**
**
** if found and winWarmth[handle][2] == 'frozen':**
** print 'Window with handle %s (source %s) is already frozen!' % (handle, source)**
** utils.Beep('Freeze')**
** else:**
** win.Freeze()**
** winWarmth[win.GetHandle()] = [level, 'frozen', source]**
** print 'Freeze successful:'**
** for item in winWarmth.items(): print ' '*4, item**
**
**def Thaw( win, source ):**
** w, handle, level, found = winWarmthLookup(win)**
**
** if found and winWarmth[handle][1] == 'frozen':**
** print 'About to thaw window with handle %d (source %s)' % (handle, source)**
** w.Thaw()**
** winWarmth[handle][1] = 'thawed'**
** print 'Thaw successful:'**
** for item in winWarmth.items(): print ' '*4, item**
** else:**
** print '%s (referenced at %s) is not frozen!' % (win.GetName(), source)**
** utils.Beep('Thaw')**
*
The *source* argument I've found most useful is simply a string containing the calling-module name (or abbreviated name) and line number.

Oh, my *utils.Beep* routine is there just to call attention to any Freeze/Thaw problems, i.e., to get me to look at the console:

*def Beep( source='???' ):**
** import winsound**
** print 'Beep from %s!' % source**
** winsound.Beep(2000,20)*

I do hope this helps someone. It's certainly helped me!

If there's a tighter way to code any of the above, please let me know.

I don't know if traveling up the window tree in my *winWarmthLookup* routine was necessary. I coded it that way because I thought my problems might be parent/child problems, e.g., freezing a parent, then thawing one or more of its children, then trying to thaw the parent. This URL made me wonder: http://wxpython-users.1045709.n5.nabble.com/Thaw-without-matching-Freeze-td2361682.html , even though the bug reported there was reported as fixed ( wxTrac has been migrated to GitHub Issues - wxWidgets ).

Bob

P.S. Got a better name than "Warmth"?

On 3/31/2014 8:11 AM, Bob Klahn wrote:

As you all may have seen in the wxPython demo failure thread of the past two days, I'm using the January 4th 3.0.1.0 beta version of wxPython (available here: http://wxpython.kosoftworks.com/preview/20140104/ ), because the December 25th 3.0.0.0 production version caused the wxPython 3.0.0.0 demo to fail. I'm using wxPython with Python 2.7.6 on my Windows XP SP3 machine.

But now I'm seeing supposedly-impossible Thaw failures. Here's an example, where I'm using a simple Notebook:

* if frame.nb1.IsFrozen(): frame.nb1.Thaw()**
*
This traceback results:

*File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 10746, in Thaw**
** return _core_.Window_Thaw(*args, **kwargs)**
**wx._core.PyAssertionError: C++ assertion "m_freezeCount" failed at ..\..\src\common\wincmn.cpp(1257) in wxWindowBase::Thaw(): Thaw() without matching Freeze()**
*
Might this "impossible" result be occurring simply because I'm using a beta version of wxPython? Since I can't use version 3.0.0.0, should I be using August 31st's 2.9.5.0 version instead? (I recently upgraded from version 2.8.10.1.)

Bob

P.S. Just in case anyone might ask: I cannot produce a small, runnable example of this behavior.

The first line of the *while* loop in the code I misposted on 4/19 should of course be *if w is None: break* , not *if w is not None: break* .

Here's an updated version I provided to a local friend of mine:

*#def Freeze( win, source ):**
**# win.Freeze()**
**#def Thaw( win, source ):**
**# win.Thaw()**

···

**
**winWarmth = {}**
**
**def winWarmthLookup(win):**
** # Check to see if we have already frozen or**
** # thawed this window or any of its parents**
** w = win**
** name = win.GetName()**
** handle = win.GetHandle()**
** level = 0**
** found = False**
** while not found:**
** if w is None: break**
** handle = w.GetHandle()**
** found = handle in winWarmth**
** if not found:**
** w = w.GetParent()**
** level += 1**
** return w, name, handle, level, found**
**
**def Freeze( win, source ):**
** w, name, handle, level, found = winWarmthLookup(win)**
**
** if found and winWarmth[handle][3] == 'frozen':**
** print '>> %s [%s] (at %s) is already frozen!' % (name, handle, source)**
** utils.Beep('Freeze')**
** else:**
** win.Freeze()**
** winWarmth[win.GetHandle()] = [name, level, source, 'frozen']**
** print 'Freeze [%s] (%s) successful:' % (handle, source)**
** for item in winWarmth.items(): print ' '*4, item**
**
**def Thaw( win, source ):**
** w, name, handle, level, found = winWarmthLookup(win)**
**
** if found and winWarmth[handle][3] == 'frozen':**
** w.Thaw()**
** winWarmth[handle][2] = source**
** winWarmth[handle][3] = 'thawed'**
** print 'Thaw [%s] (%s) successful:' % (handle, source)**
** for item in winWarmth.items(): print ' '*4, item**
** else:**
** print '>> %s [%s] (%s) is not frozen!' % (win.GetName(), win.GetHandle(), source)**
** utils.Beep('Thaw')**
*
Does anyone here know if the *while* loop is ever necessary? The Freeze/Thaw failures I was experiencing and that motivated this code did not require any child-to-parent traversals, so I still don't know.

Bob

On 4/19/2014 9:19 PM, Bob Klahn wrote:

This may help someone ...

I have at last solved the Thaw-failure problems I recently experienced after upgrading Python from 2.5 to 2.7.6 and wxPython from 2.8.10.1 to beta 3.0.1.0. What a relief! I did so by replacing all direct calls to *Freeze()* and *Thaw()* with calls to this code, placed in a separate module:

*winWarmth = {}**
**
**def winWarmthLookup(win):**
** # Check to see if we have already frozen or**
** # thawed this window or any of its parents**
** w = win**
** handle = win.GetHandle()**
** level = 0**
** found = False**
** while not found:**
** if w is not None: break**
** handle = w.GetHandle()**
** found = handle in winWarmth**
** if not found:**
** w = w.GetParent()**
** level += 1**
** return w, handle, level, found**
**
**def Freeze( win, source ):**
** w, handle, level, found = winWarmthLookup(win)**
**
** if found and winWarmth[handle][2] == 'frozen':**
** print 'Window with handle %s (source %s) is already frozen!' % (handle, source)**
** utils.Beep('Freeze')**
** else:**
** win.Freeze()**
** winWarmth[win.GetHandle()] = [level, 'frozen', source]**
** print 'Freeze successful:'**
** for item in winWarmth.items(): print ' '*4, item**
**
**def Thaw( win, source ):**
** w, handle, level, found = winWarmthLookup(win)**
**
** if found and winWarmth[handle][1] == 'frozen':**
** print 'About to thaw window with handle %d (source %s)' % (handle, source)**
** w.Thaw()**
** winWarmth[handle][1] = 'thawed'**
** print 'Thaw successful:'**
** for item in winWarmth.items(): print ' '*4, item**
** else:**
** print '%s (referenced at %s) is not frozen!' % (win.GetName(), source)**
** utils.Beep('Thaw')**
*
The *source* argument I've found most useful is simply a string containing the calling-module name (or abbreviated name) and line number.

Oh, my *utils.Beep* routine is there just to call attention to any Freeze/Thaw problems, i.e., to get me to look at the console:

*def Beep( source='???' ):**
** import winsound**
** print 'Beep from %s!' % source**
** winsound.Beep(2000,20)*

I do hope this helps someone. It's certainly helped me!

If there's a tighter way to code any of the above, please let me know.

I don't know if traveling up the window tree in my *winWarmthLookup* routine was necessary. I coded it that way because I thought my problems might be parent/child problems, e.g., freezing a parent, then thawing one or more of its children, then trying to thaw the parent. This URL made me wonder: http://wxpython-users.1045709.n5.nabble.com/Thaw-without-matching-Freeze-td2361682.html , even though the bug reported there was reported as fixed ( wxTrac has been migrated to GitHub Issues - wxWidgets ).

Bob

P.S. Got a better name than "Warmth"?

On 3/31/2014 8:11 AM, Bob Klahn wrote:

As you all may have seen in the wxPython demo failure thread of the past two days, I'm using the January 4th 3.0.1.0 beta version of wxPython (available here: http://wxpython.kosoftworks.com/preview/20140104/ ), because the December 25th 3.0.0.0 production version caused the wxPython 3.0.0.0 demo to fail. I'm using wxPython with Python 2.7.6 on my Windows XP SP3 machine.

But now I'm seeing supposedly-impossible Thaw failures. Here's an example, where I'm using a simple Notebook:

* if frame.nb1.IsFrozen(): frame.nb1.Thaw()**
*
This traceback results:

*File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 10746, in Thaw**
** return _core_.Window_Thaw(*args, **kwargs)**
**wx._core.PyAssertionError: C++ assertion "m_freezeCount" failed at ..\..\src\common\wincmn.cpp(1257) in wxWindowBase::Thaw(): Thaw() without matching Freeze()**
*
Might this "impossible" result be occurring simply because I'm using a beta version of wxPython? Since I can't use version 3.0.0.0, should I be using August 31st's 2.9.5.0 version instead? (I recently upgraded from version 2.8.10.1.)

Bob

P.S. Just in case anyone might ask: I cannot produce a small, runnable example of this behavior.

No virus found in this message.
Checked by AVG - www.avg.com <http://www.avg.com>
Version: 2014.0.4355 / Virus Database: 3882/7366 - Release Date: 04/19/14

--
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 wxpython-users+unsubscribe@googlegroups.com <mailto:wxpython-users+unsubscribe@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.