[wxPython-users] Basics of drawing on a wx.Panel
by other posts by this author
Dec 11 2004 1:25PM messages near this date
Re: [wxPython-users] Create one menu for whole program
|
Re: [wxPython-users] Basics of drawing on a wx.Panel
Hello,
I have recently started to explore the wxPython opportunities to generate
small graphics. As a very first example, I wrote the following:
import wx
#____________________________
class MainWindow(wx.Frame):
def __init__(self,parent,id,title):
wx.Frame.__init__(self,parent,-1, title,
style=wx.DEFAULT_FRAME_STYLE)
self.panel = wx.Panel(self,-1)
self.sizer = wx.BoxSizer(wx.HORIZONTAL)
self.sizer.Add(self.panel,1,wx.ALL)
self.SetSize(wx.Size(400,400))
self.SetSizer(self.sizer)
self.SetAutoLayout(True)
self.sizer.Fit(self)
dc = wx.ClientDC(self.panel)
dc.BeginDrawing()
dc.SetPen(wx.Pen(wx.RED,20))
dc.DrawLine(5,200,50,300)
dc.EndDrawing()
self.Refresh()
app = wx.PySimpleApp()
frame = MainWindow(None, -1, "Draw Demo")
frame.Show(True)
app.MainLoop()
But I cannot see the expected line. What have I missed?
Many thanks in advance for your help
Peter
--
GMX ProMail mit bestem Virenschutz http://www.gmx.net/de/go/mail
+++ Empfehlung der Redaktion +++ Internet Professionell 10/04 +++
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@[...].org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
Thread:
Robin Dunn
Vladimir Ignatov
|