본문 바로가기
Programming/PYTHON_ETC

wxpython 간단한 프레임 예제(FlexGridSizer)

by Wilkyway 2020. 6. 16.
import wx

class MyFrame(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, parent=None, title="FlexGridSizer Example")
        self.SetSize(400, 370)
        self.mainPanel = wx.Panel(self)

        self.fgridSizer = wx.FlexGridSizer(rows=3, cols=2, hgap=5, vgap=5)

        self.staticName = wx.StaticText(self.mainPanel, label= "name :")
        self.staticEmail = wx.StaticText(self.mainPanel, label = "email :")
        self.staticPhone = wx.StaticText(self.mainPanel, label = "phone :")

        self.textName = wx.TextCtrl(self.mainPanel)
        self.textEmail = wx.TextCtrl(self.mainPanel)
        self.textPhone = wx.TextCtrl(self.mainPanel)

        self.fgridSizer.Add(self.staticName)
        self.fgridSizer.Add(self.textName, 0, wx.EXPAND)
        self.fgridSizer.Add(self.staticEmail)
        self.fgridSizer.Add(self.textEmail, 0, wx.EXPAND)
        self.fgridSizer.Add(self.staticPhone)
        self.fgridSizer.Add(self.textPhone, 0, wx.EXPAND)

        self.fgridSizer.AddGrowableCol(1)
        self.fgridSizer.AddGrowableRow(2)

        self.vtBoxSizer = wx.BoxSizer(wx.VERTICAL)
        self.vtBoxSizer.Add(self.fgridSizer, 1, wx.EXPAND|wx.ALL, 5)
        self.mainPanel.SetSizer(self.vtBoxSizer)

if __name__ == "__main__":
    app = wx.App()
    frame = MyFrame()
    frame.Show()

    app.MainLoop()

 

'Programming > PYTHON_ETC' 카테고리의 다른 글

wxpython 폴더 트리  (0) 2020.06.16
wxpython 간단한 메뉴  (0) 2020.06.16
wxpython 간단한 프레임 예제(FlexGridSizer)  (0) 2020.06.16
wxpython 간단한 프레임 예제(BoxSizer)  (0) 2020.06.16
wxpython 간단한 프레임 예제  (0) 2020.06.16
Python - GUI에서 DB연결  (0) 2020.02.26

댓글0