我正在尝试在wxButton内对齐标签并使用
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_COOKIE} !^.*userstate.*$ [NC]
RewriteRule ^(.*)$ www.domain.com/index.html [NC,L]
style=wx.TEXT_ALIGNMENT_LEFT
但是它仍然在中心显示标签。
左对齐按钮标签的正确方法是什么?
答案 0 :(得分:1)
使用按钮样式。(BU_LEFT,BU_RIGHT,BU_TOP,BU_BOTTOM)
import wx
class ButtonFrame(wx.Frame):
def __init__(self, value):
wx.Frame.__init__(self,None)
self.btn1 = wx.Button(self, -1, ("Left"), size=(80,80), style = wx.BU_LEFT)
self.btn2 = wx.Button(self, -1, ("Center"), size=(80,80))
self.btn3 = wx.Button(self, -1, ("Right"), size=(80,80), style = wx.BU_RIGHT)
self.btn4 = wx.Button(self, -1, ("Top"), size=(80,80), style = wx.BU_TOP)
self.btn5 = wx.Button(self, -1, ("Bottom"), size=(80,80), style = wx.BU_BOTTOM)
self.btnSizer1 = wx.BoxSizer(wx.HORIZONTAL)
self.btnSizer1.Add(self.btn1 , 0, wx.RIGHT, 10)
self.btnSizer1.Add(self.btn2 , 0, wx.RIGHT, 10)
self.btnSizer1.Add(self.btn3 , 0, wx.RIGHT, 10)
self.btnSizer2 = wx.BoxSizer(wx.HORIZONTAL)
self.btnSizer2.Add(self.btn4 , 0, wx.RIGHT, 10)
self.btnSizer2.Add(self.btn5 , 0, wx.RIGHT, 10)
self.btnSizer = wx.BoxSizer(wx.VERTICAL)
self.btnSizer.Add(self.btnSizer1)
self.btnSizer.Add(self.btnSizer2)
self.SetSizer(self.btnSizer)
self.Centre()
self.Show()
if __name__ == "__main__":
app = wx.App(False)
ButtonFrame(None)
app.MainLoop()