How to refresh the canvas

Hi,
I have one wxWindows application which draws the ogl shapes over the wxCanvas.
When I delete the shapes they get actually deleted but the canvas still shows those shapes.
I could realize the deletion only if I resize/(minimize/maximize) the window.

How to refresh the canvas as soon as I delete the shape?

Thanks in advance.

With regards
Kamesh Jayachandran

Hi all,

This is a continuation of my 'printing' saga, which some of you may recall
from last year.

I have completed upgrading the various packages on my RH9 box. I can now
switch easily between wxPython 2.4.1.2 with Python 2.2.3 and GTK2, wxPython
2.4.2.4 with Python 2.3.3 and GTK1, and wxPython 2.4.2.4 with Python 2.3.3
and GTK2.

Most of my printing problems are caused by GTK2. To be specific -
- text underlining does not work in preview or in print mode
- I have to set the point size to 80 to get a reasonable output
- the quality of the output is poor
- printing to file and running ps2ascii does not produce any text

Using GTK1, none of these problems occur.

I still have a performance problem, with both GTK1 and GTK2. Running the
attached program and printing to my HP LaserJet IIIP, it takes over 4
seconds to send the page to the printer. Printing a similar page from
OpenOffice Writer, to the same printer, using the same computer, takes about
1 second. Running the same program to the same printer from MSW, on a slower
computer, takes about half a second. Printing a similar page from
HTMLEasyPrinting also takes about 4 seconds.

I will stick to GTK1 for now, even though the screen appearance is not as
attractive. Any comments will be most welcome.

Thanks

Frank Millman

print6.py (3.28 KB)

Hi all,

There have been various reports in the past about error messages such as the
following -

"Gdk-CRITICAL **: file gdkgc.c: line 689 (gdk_gc_set_clip_rectangle):
assertion 'gc != NULL' failed"

Robin's response tends to be that these messages are very difficult to
trace, but one can normally make them disappear by experimenting with
various approaches. This has worked for me in the past.

I now have a situation where a group of three messages has started appearing
since I switched from GTK2 on 2.4.1.2 to GTK1 on 2.4.2.4. I have now got
both GTK1 and GTK2 working on 2.4.2.4, and I can confirm that these messages
only appear when using GTK1.

I can pinpoint the origin of the messages. They appear when I create a
frame, but before 'showing' the frame, I invoke a dialog box with the frame
as a parent. This works fine with MSW and with GTK2, and it also works with
GTK1 - it is just that the three error messages appear.

I attach a sample program. Any comments will be welcome.

Thanks

Frank Millman

fm20.py (2.71 KB)

The way I do it is derived from one of the tutorials IIRC:

  self.diagram.RemoveShape(shape)
  shape.RemoveFromCanvas(self)
  self.Refresh(False, bounds)

where 'bounds' is a wxRect large enough to cover the area of the shape,
and self is a class derived from wxShapeCanvas.

HTH --

  -frank

···

On Tue, 6 Jan 2004, kamesh jayachandran wrote:

Hi,
I have one wxWindows application which draws the ogl shapes over the wxCanvas.
When I delete the shapes they get actually deleted but the canvas still shows those shapes.
I could realize the deletion only if I resize/(minimize/maximize) the window.

How to refresh the canvas as soon as I delete the shape?

Frank Millman wrote:

Hi all,

There have been various reports in the past about error messages such as the
following -

"Gdk-CRITICAL **: file gdkgc.c: line 689 (gdk_gc_set_clip_rectangle):
assertion 'gc != NULL' failed"

Robin's response tends to be that these messages are very difficult to
trace, but one can normally make them disappear by experimenting with
various approaches. This has worked for me in the past.

I now have a situation where a group of three messages has started appearing
since I switched from GTK2 on 2.4.1.2 to GTK1 on 2.4.2.4. I have now got
both GTK1 and GTK2 working on 2.4.2.4, and I can confirm that these messages
only appear when using GTK1.

I can pinpoint the origin of the messages. They appear when I create a
frame, but before 'showing' the frame, I invoke a dialog box with the frame
as a parent. This works fine with MSW and with GTK2, and it also works with
GTK1 - it is just that the three error messages appear.

I attach a sample program. Any comments will be welcome.

For efficiency reasons wxGTK will often delay parts of the initialization, or updates, or etc. until some time later (like the next idle time) so more things can be done all at once. In the case of window creation some internal gtk things are not created until the window is shown and apparently showing the dialog tried to use those things in the parent. As you've seen these warnings can be ignored, but you can work around them if they get too annoying: Either show and then hide the frame before showing the dialog, or don't make the dialog a child of the frame (if it's not shown having children doesn't make much sense anyway,) or perhaps catch EVT_CREATE_WINDOW and show the dialog from that handler.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!