Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- python
- graphene-django
- numpy
- Django
- flask
- FastAPI
- array
- check_password
- GraphQL
- for loop
- tkinter Radio 동적버튼
- allauth
- Django-allauth
- SQL
Archives
- Today
- Total
객
wxpython ............. 본문
#!/usr/bin/python #coding: cp949 #======================================================================== # 화일명 : HelloWorld.py # # 이 프로그램은 wxPython의 예제 프로그램을 수정하여 만들었습니다.. # wx.Fame, wx.panel , wx.Button을 이용 # #======================================================================== import! wx class MyFrame(wx.Frame): """ This is MyFrame. It just shows a few controls on a wxPanel. """ def __init__(self, parent, title): wx.Frame.__init__(self, parent, -1, title, pos=(300, 200), size=(300, 230)) # Now create the Panel to put the other controls on. panel = wx.Panel(self) # and a few controls """------------------------------------------------------------ 1). StaticText : Parent : window. Should not be NULL. id : Control identifier. A value of -1 denotes a default value. label : Text label. pos : Window position. size : Window size. style : Window style. name : Window name. 2). Window styles: wxALIGN_LEFT wxALIGN_RIGHT wxALIGN_CENTRE wxST_NO_AUTORESIZE --------------------------------------------------------------- """ text = wx.StaticText(panel, -1, "환영 합니다.\n어서 오세요") """------------------------------------------------------------ 1). wxFont pointSize : Size in points. pixelSize : Size in pixels: this is directly supported only under MSW currently where this constructor can be used directly, under other platforms a font with the closest size to the given one is found using binary search and the static New method must be used. family : Font family, a generic way of referring to fonts without specifying actual facename. one of: wxFONTFAMILY_DEFAULT : Chooses a default font. wxFONTFAMILY_DECORATIVE : A decorative font. wxFONTFAMILY_ROMAN : A formal, serif font. wxFONTFAMILY_SCRIPT : A handwriting font. wxFONTFAMILY_SWISS : A sans-serif font. wxFONTFAMILY_MODERN : A fixed pitch font. wxFONTFAMILY_TELETYPE : A teletype font. style : one of wxFONTSTYLE_NORMAL, wxFONTSTYLE_SLANT and wxFONTSTYLE_ITALIC. weight : Font weight, sometimes also referred to as font boldness. one of: wxFONTWEIGHT_NORMAL : Normal font. wxFONTWEIGHT_LIGHT : Light font. wxFONTWEIGHT_BOLD : Bold font. underline : The value can be true or false. At present this has an effect on Windows and Motif 2.x only. faceName : An optional string specifying the actual typeface to be used. If it is an empty string, a default typeface will be chosen based on the family. encoding : An encoding which may be one of wxFONTENCODING_SYSTEM : Default system encoding. wxFONTENCODING_DEFAULT : Default application encoding: this is the encoding set by calls to SetDefaultEncoding and which may be set to, say, KOI8 to create all fonts by default with KOI8 encoding. Initially, the default application encoding is the same as default system encoding. wxFONTENCODING_ISO8859_1...15 : ISO8859 encodings. wxFONTENCODING_KOI8 : The standard Russian encoding for Internet. wxFONTENCODING_CP1250...1252 : Windows encodings similar to ISO8859 (but not identical). 2). SetFont font : Font to associate with this window, pass wxNullFont to reset to the default font. --------------------------------------------------------------- """ text.SetFont(wx.Font(30, wx.SWISS, wx.NORMAL, wx.BOLD)) text.SetSize(text.GetBestSize()) #--------------------------------------------------------------- # wx.Button은 붙일 곳, id , 버튼의 이름 , 버튼의 위치 #--------------------------------------------------------------- btn = wx.Button(panel, -1, "종 료" , pos=(50,100)) funbtn = wx.Button(panel, -1, "안녕 !",pos=(140,100)) #--------------------------------------------------------------- # 버튼을 클릭 했을시에 발생되는 이벤트를 지정하고 있다. # 버튼의 이벤트옵션 , 함수 호출 , 버튼 변수 #--------------------------------------------------------------- self.Bind(wx.EVT_BUTTON, self.OnTimeToClose, id=btn.GetId()) self.Bind(wx.EVT_BUTTON, self.OnFunButton, id=funbtn.GetId()) # Use a sizer to layout the controls, stacked vertically and with # a 10 pixel border around each sizer = wx.BoxSizer(wx.VERTICAL) # 텍스트 및 버튼의 변수명, 버튼의 크기 , 옵션, 크기 sizer.Add(text, 1, wx.ALL, 10) sizer.Add(btn, 0, wx.ALL, 10) sizer.Add(funbtn, 0, wx.ALL, 10) """ 버튼 WXALL 지정하고 위치 값을 지정 하면 칼렴 형식의 버튼이 됨""" # 프로그램 종료 버튼클릭시 호출 되는 함수 def onTimeToClose(self, evt): self.Close() # 안녕이란 버튼을 클릭시 발생되는 이벤트 함수 def onFunButton(self, evt): print "안녕 하세요" class MyApp(wx.App): def onInit(self): frame = MyFrame(None, "wxPython App 예제 소스") self.SetTopWindow(frame) print "윈도우 창에서 출력되는 모습을 난타낸다." frame.Show(True) return True app = MyApp(True) app.MainLoop() |
'[PL] > Python' 카테고리의 다른 글
[GUI] wxPython 사용하여만든 것입니다. (0) | 2007.10.16 |
---|---|
[GUI ] wxpython 을 사용하여. (0) | 2007.10.12 |
PIL 이용한 이미지처리 - 3 (0) | 2007.09.20 |
PIL 이용한 이미지처리 - 2 (0) | 2007.09.20 |
PIL 모듈을이용하여 이미지 처리 (0) | 2007.09.17 |