HT clear some wxPython fram?
Cliff Wells
logiplexsoftware at earthlink.net
Wed Jul 3 16:16:07 EDT 2002
On Wed, 03 Jul 2002 21:18:52 +0200
Klaus Reinhardt wrote:
> Am 03.07.02 20:47:14, schrieb Cliff Wells <logiplexsoftware at earthlink.net>:
>
>
> >class MyPanel(wxPanel):
> > def __init__(self, parent, fontsize = 12):
> > wxPanel.__init__(self, parent, -1)
> > self.SetBackgroundColour(wxWHITE)
> > self.text = []
> > self.fontsize = fontsize
> > EVT_PAINT(self, self.OnPaint)
> >
> > def draw(self, dc):
> > dc.Clear()
> > font = wxFont(self.fontsize, wxMODERN, wxNORMAL, wxNORMAL)
> > dc.SetFont(font)
> > y = 0
> > for t in self.text:
> > dc.DrawText(t, 0, y)
> > y += self.fontsize + 2
> >
> ---------------------------------------------------------------------
> Hi
>
> OK! Well done.
>
> A further problem: The frame is 'renewed' after 14 rows, so the
> netstat-output is in the beginning (more than) doubled. Is some sort of -
> excuse me - GOTOXY? Or is this another buffer(?)problem?
If you look at MyPanel.draw(), you'll see a line like:
dc.DrawText(t, x, y)
where x, y are the screen coordinates relative to the top-left corner.
You could also add a MyPanel.clear() method:
class MyPanel(...)
...
def clear(self):
dc = wxClientDC(self)
dc.Clear()
It also occurs to me (somewhat belatedly) that wxPython has wxLog that might do
what you want without a lot of programming (see the demo - it uses it
extensively).
Regards,
--
Cliff Wells, Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308 (800) 735-0555 x308
More information about the Python-list
mailing list