Python
http://www.python.org/download/
-> Python 2.4.1 Windows installer
Active python
http://www.activestate.com/
wxPython
http://www.wxpython.org/
-> Download -> Binaries
-> wxPython2.6-win32-unicode-2.6.0.0-py24.exe
wxPython2.6-win32-docs-demos-2.6.0.0.exe
http://wiki.wxpython.org/index.cgi/How_20to_20Learn_20wxPython
http://wiki.wxpython.org/
http://wiki.wxpython.org/index.cgi/Getting_20Started
Python Library Reference
http://www.python.org/doc/2.4.1/lib/lib.html
HTTP request보내기
http://www.python.org/doc/2.4.1/lib/module-httplib.html
http://www.python.org/doc/2.4.1/lib/httplib-examples.html
fpconst (A Python module for handling IEEE 754 floating point special values)
설치하기
http://research.warnes.net/projects/RStatServer/fpconst/
-> fpconst-0.7.2.zip
압축해제
cmd창 열기
c:\Python24\python.exe setup.py install
SOAPpy 설치하기
http://pywebsvcs.sourceforge.net/
SOAPpy-0.12.0.zip을 받음.
압축해제
cmd창 열기
c:\Python24\python.exe setup.py build
c:\Python24\python.exe setup.py install
책
파이썬 시작하기
---------------------------------
Python 예제 프로그램(Google API 이용하기)
import httplib, urllib
from wxPython.wx import *
class Form1(wxPanel):
def __init__(self, parent, id):
wxPanel.__init__(self, parent, id, wxPoint(), wxSize(500, 500))
self.msgKeyword = wxStaticText(self, -1, "Keyword :", wxPoint(20, 30))
self.keyword = wxTextCtrl(self, 20, "", wxPoint(100, 30), wxSize(140,-1))
self.button = wxButton(self, 10, "Search", wxPoint(250, 30))
EVT_BUTTON(self, 10, self.OnClick)
self.display = wxTextCtrl(self, 5, "", wxPoint(20, 60), wxSize(700, 500),
wxTE_MULTILINE | wxTE_READONLY)
def OnClick(self,event):
self.display.AppendText("Keyword: %s\n" % self.keyword.GetValue())
headers = {"Content-type": "text/xml; charset=utf-8"}
conn = httplib.HTTPConnection("api.google.com:80")
conn.request("POST", "/search/beta2", "<?xml version='1.0' encoding='UTF-8'?> \
<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/1999/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/1999/XMLSchema\"> \
<SOAP-ENV:Body> \
<ns1:doGoogleSearch xmlns:ns1=\"urn:GoogleSearch\" \
SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"> \
<key xsi:type=\"xsd:string\">키값</key> \
<q xsi:type=\"xsd:string\">" + self.keyword.GetValue() "</q> \
<start xsi:type=\"xsd:int\">0</start> \
<maxResults xsi:type=\"xsd:int\">10</maxResults> \
<filter xsi:type=\"xsd:boolean\">true</filter> \
<restrict xsi:type=\"xsd:string\"></restrict> \
<safeSearch xsi:type=\"xsd:boolean\">false</safeSearch> \
<lr xsi:type=\"xsd:string\"></lr> \
<ie xsi:type=\"xsd:string\">latin1</ie> \
<oe xsi:type=\"xsd:string\">latin1</oe> \
</ns1:doGoogleSearch> \
</SOAP-ENV:Body> \
</SOAP-ENV:Envelope>", headers)
response = conn.getresponse()
self.display.AppendText("%s\n" % response.status);
self.display.AppendText("%s\n" % response.reason);
data = response.read()
conn.close()
print data;
self.display.AppendText( "%s\n" % data.decode('utf-8').encode('cp949') );
app = wxPySimpleApp()
frame = wxFrame(None, -1, " Our first Control")
Form1(frame, -1)
frame.Show(1)
app.MainLoop()
댓글 없음:
댓글 쓰기