Python Forum
how to draw simple line in wxPython?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to draw simple line in wxPython?
#2
What do you have so far?

Have you tried this? https://wiki.wxpython.org/VerySimpleDrawing
Quote:
import wx

class DrawPanel(wx.Frame):

    """Draw a line to a panel."""

    def __init__(self):
        wx.Frame.__init__(self, title="Draw on Panel")
        self.Bind(wx.EVT_PAINT, self.OnPaint)

    def OnPaint(self, event=None):
        dc = wx.PaintDC(self)
        dc.Clear()
        dc.SetPen(wx.Pen(wx.BLACK, 4))
        dc.DrawLine(0, 0, 50, 50)

app = wx.App(False)
frame = DrawPanel()
frame.Show()
app.MainLoop()
Reply


Messages In This Thread
RE: how to draw simple line in wxPython? - by nilamo - Mar-21-2018, 03:45 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  WxPython Line Number QueenSvetlana 0 2,487 Dec-14-2017, 03:42 AM
Last Post: QueenSvetlana

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020