如何使用wxpython绘制垂直线

时间:2011-01-07 06:24:34

标签: wxpython

我正在尝试下面的代码仍然它给我横向线..我错过了什么?

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))

2 个答案:

答案 0 :(得分:7)

此代码适用于我

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()

答案 1 :(得分:0)

感谢您的回复 得到它现在..我缺少样式关键字..earliar它没有给出错误,这就是为什么 没找到它

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