Add contro to frame and layout them : Frame « wxPython « Python Tutorial

Python Tutorial
1. Introduction
2. Data Type
3. Statement
4. Operator
5. String
6. Tuple
7. List
8. Dictionary
9. Collections
10. Function
11. Class
12. File
13. Buildin Function
14. Buildin Module
15. Database
16. Regular Expressions
17. Thread
18. Tkinker
19. wxPython
20. XML
21. Network
22. CGI Web
23. Windows
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorial
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Python Tutorial » wxPython » Frame 
19. 15. 12. Add contro to frame and layout them
Add contro to frame and layout them
import wx

class MyFrame(wx.Frame):
    def __init__(self, parent=None, id=-1, title=''):
        wx.Frame.__init__(self, parent, id, title,size=(200140))
        top = wx.Panel(self)
        sizer = wx.BoxSizer(wx.VERTICAL)
        font = wx.Font(9, wx.SWISS, wx.NORMAL, wx.BOLD)
        lb = wx.StaticText(top, -1,'static text')
        sizer.Add(lb)

        c1 = wx.StaticText(top, -1'Number:')
        c1.SetFont(font)
        ct = wx.SpinCtrl(top, -1'2', min=2, max=12)
        sizer.Add(c1)
        sizer.Add(ct)

        c2 = wx.StaticText(top, -1'Type:')
        c2.SetFont(font)
        cb = wx.ComboBox(top, -1'',choices=('A''B''C','D'))
        sizer.Add(c2)
        sizer.Add(cb)

        qb = wx.Button(top, -1"QUIT")
        self.Bind(wx.EVT_BUTTON,lambda e: self.Close(True), qb)
        sizer.Add(qb)

        top.SetSizer(sizer)
        self.Layout()

class MyApp(wx.App):
   def OnInit(self):
       frame = MyFrame(title="wxWidgets")
       frame.Show(True)
       self.SetTopWindow(frame)
       return True

app = MyApp()
app.MainLoop()
19. 15. Frame
19. 15. 1. Set the size of windowSet the size of window
19. 15. 2. Default frame styleDefault frame style
19. 15. 3. Creating and Showing a FrameCreating and Showing a Frame
19. 15. 4. Display a frameDisplay a frame
19. 15. 5. Set top windowSet top window
19. 15. 6. Frame that displays an image.
19. 15. 7. Adding Labels and Titles with Keyword ArgumentsAdding Labels and Titles with Keyword Arguments
19. 15. 8. Frame with events: on close, on close windowFrame with events: on close, on close window
19. 15. 9. On init and on exitOn init and on exit
19. 15. 10. Bind key event and button eventBind key event and button event
19. 15. 11. Set frame propertiesSet frame properties
19. 15. 12. Add contro to frame and layout themAdd contro to frame and layout them
19. 15. 13. Subclass frameSubclass frame
19. 15. 14. Help ContextHelp Context
www.java2java.com | Contact Us
Copyright 2010 - 2030 Java Source and Support. All rights reserved.
All other trademarks are property of their respective owners.