How to draw a vertical line using wxpython

I am trying to make the code below, but it gives me a horizontal line. Did I miss something?

self.ln = wx.StaticLine (self, -1, wx.Point (620.0), wx.Size (687.7), wx.LI_VERTICAL)

self.ln.SetForegroundColour (wx.Colour (255,0,255))

+3
source share
2 answers

This code works for me

import wx 

class MyFrame(wx.Frame): 
    """ Test of vertical wx.StaticLine """
    def __init__(self, parent=None, id=-1, title=None): 
        wx.Frame.__init__(self, parent, id, title) 
        self.panel = wx.Panel(self, size=(350, 200))

        self.ln = wx.StaticLine(self.panel, -1, style=wx.LI_VERTICAL)
        self.ln.SetSize((30,30))

        print self.ln.IsVertical()

        self.Fit() 

app = wx.PySimpleApp() 
frame1 = MyFrame(title='wx.StaticLine') 
frame1.Center() 
frame1.Show() 
app.MainLoop()
+6
source

thanks for ur answer got it now .. i was missing the style keyword..earliar it did not give an error so did not find it

self.ln = wx.StaticLine (self, -1, size = (4,479), style = wx.LI_VERTICAL)

0
source

Source: https://habr.com/ru/post/1784020/


All Articles