PyQt - clear widget for redraw

From: Peter (nospamjynyl_at_yahoo.co.nz)
Date: 07/31/04


Date: Sat, 31 Jul 2004 23:02:24 +1200


I want to draw some lines on a widget.
This works ok, but when I want to redraw, the old lines are still there.

How do I clear or refresh the widget, so I can draw a new set of lines?

Code snip below.

TIA

Peter

-------------------------
 def paintLines(self, e):
      p = QPainter(e)
      mar = e.width()/100 # margin
      vsp = 2 # vertical spacing
      hrz = (e.width() - 2*mar)/100 # horizontal scalar
      for i in range(100):
          p.drawLine(mar,mar+vsp*i,hrz*(l1[i]+1),mar+vsp*i)
-------------------------



Relevant Pages

  • Re: Make custom controls with GTK
    ... Derive a new widget from GtkButton, ... I'll check the function you suggeted in the documentation at GTK site ... is also possible to refresh the button draw every time some event ...
    (comp.os.linux.development.apps)
  • Re: PyQt - clear widget for redraw
    ... Peter wrote: ... > How do I clear or refresh the widget, so I can draw a new set of lines? ... Or redraw a rectangle yourself. ...
    (comp.lang.python)
  • Re: Tkinter custom drawing
    ... I just want to draw over them, which is a bit difficult in my ... comprehension of things. ... What are you trying to achieve by "drawing over" widgets? ... So, my intent, is to create a widget under the widget. ...
    (comp.lang.python)
  • Re: poplog-dev Re: pop-forum Overlapping moving picture objects [Was:
    ... you redraw the whole window, but if you redraw only parts near the ... So you don't draw *anything* when an object moves. ... As I said, it's conceptually very simple and robust, and not ... I suspect that dragging behind other objects would be tricky using the ...
    (comp.lang.pop)
  • GDI+ questions
    ... I'm using GDI+ api to draw a day time planning into a picture, it's great, ... I have one problem, 90% of the time, I don't need to redraw all the picture, ...
    (microsoft.public.vb.winapi.graphics)