Developing with pyGTK in EeePC
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

Developing with pyGTK in EeePC

  • 2,620 views
Uploaded on

speech delivered in EeePC Developer's Day, on May 8, 2008.

speech delivered in EeePC Developer's Day, on May 8, 2008.

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
2,620
On Slideshare
2,618
From Embeds
2
Number of Embeds
1

Actions

Shares
Downloads
13
Comments
0
Likes
1

Embeds 2

http://www.slideshare.net 2

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • http://www.flickr.com/photos/82365211@N00/2473197800

Transcript

  • 1. Developing with pyGTK in EeePC 胡崇偉 [email_address] 自由軟體鑄造場 http://www.openfoundry.org/ 中央研究院 資訊科學研究所
  • 2. 自由軟體鑄造場的服務特色
    • 提供協同式專案開發知識及工具
    • 提供法務授權條款專業諮詢
    • 與學術研究單位及社群團體密切連繫
    • 培育人才並提供教學訓練材料
  • 3. OpenFoundry 網站功能簡介 專案管理
  • 4. OpenFoundry 網站功能簡介 專案管理 版本管理 待辦事項 共同筆記 檔案下載 通信論壇 統計資訊
  • 5. OpenFoundry 網站功能簡介 專案管理 版本管理 待辦事項 共同筆記 檔案下載 通信論壇 統計資訊 授權條款 精靈 電子報 人才資料庫 推廣光碟 資源目錄 研究報告 教學文件
  • 6.  
  • 7.  
  • 8.  
  • 9.  
  • 10. Easy Path to Linux Programming
  • 11. Easy Path to App Programming
    • Especially for EeePC Linux Application Development, where requires the ability to quickly prototype and to glue software components.
  • 12. Benefits Using Python
    • Easy to Implement
    • Easy to Integrate
    • Rich Libraries and Sample Codes
  • 13. Python Programming Overview
    • Builtins
    • Data Types
    • Functions
    • Classes/Objects
    • Methods (Member Functions)
    • Modules
    • Packages
  • 14. Checking Basic Info
    • python -V
      • Show Version Info
    • dir()
      • Show Namespace Info
  • 15. Basic Data Types
    • myString = “Hello World”
    • myList = [‘I’, ‘Love’, 7, 11]
    • myTuple = (myList, ‘works’, 2)
    • myDictionary = {“name”:”marr”,”location”:”taipei”}
  • 16. Indexing and Slicing
    • myString = “I Love Python”
    • myString[0] == “I”
    • myString[-1] == “n”
    • myString[7:-2] == “Pyth”
    n o h t y P e v o L I [ ] -1 ↓ -2 ↓ 7 -6 ↓ 2 ↓ 1 ↓ 0 ↓
  • 17. Builtin Function Example
    • range(3)‏
    • [0, 1, 2]
    • for a in range(3):
    • print “count down”, a
  • 18. Indenting Code
    • No explicit begin or end
    • No curly braces
    • Use colon (:) and the indentation
  • 19. Python Style Guide
    • http://www.python.org/doc/essays/styleguide.html
    • Lay-out -- how to use tabs, spaces, and newlines.
    • Comments -- on proper use of comments (and documentation strings).
    • Names -- various naming conventions.
  • 20. Importing Modules
    • myString = “250”
    • import math
    • math.sqrt(myString)
    • TypeError: a float is required
    • from string‏ import atoi
    • atoi(myString)
    • 250
  • 21. Function Example
    • def myFunc(score):
    • “””
    • document strings
    • “””
    • import math
    • math.sqrt(score) * 10
  • 22. Libraries and Their Capabilities
    • OS Operation
      • import os
      • import sys
    • File Handling
      • open()
    • Networking
      • Socket creating and handling
      • Twisted for high level applications
  • 23. import os
    • os.chdir()
    • os.getenv(“HOME”)
    • os.listdir(os.getcwd())
  • 24. import sys
    • sys.path
    • sys.stdin
    • sys.stdout
    • sys.stderr
  • 25. File Handling
    • fileobj = open(“myfile”, “r”)
    • lines = fileobj.readlines()
    • for line in lines:
    • print line
  • 26. Socket Connection for Client/Server
    • Socket Creation
    • Port Binding
    • Raw Data I/O (sending and receiving)
    • select() and pull() for Nonblocking sockets
  • 27. Socket Creation
    • import socket
    • s = socket.socket(
    • socket.AF_INET,
    • socket.SOCK_STREAM)
    • s.connect(
    • ("www.mysite.com", 80))
  • 28. Port Binding
    • import socket
    • serversocket = socket.socket(
    • socket.AF_INET,
    • socket.SOCK_STREAM)
    • serversocket.bind(
    • (socket.gethostname(), 80))
    • serversocket.listen(5)
  • 29. FTP lib
    • from ftplib import FTP
    • ftp = FTP(“ftp.cdrom.com”)
    • print ftp.login()
    • ftp.retrlines('LIST‘)
    • filename = “toPut.exe”
    • file = open(filename, ‘wb’)
  • 30. FTP library example - miniFTP
    • FTP Object and Dialog Initialization
    • Login to Server and Logout from Server
    • File List Generation
    • File Get/Put/Remove
    • Event Handling: BUTTON_PRESS event, error exception
  • 31. gtkmozembed
    • Get ready with these packages
      • xulrunner
      • libxul-dev
      • python-gnome2-extras
    • http://www.pygtk.org/pygtkmozembed/class-gtkmozembed.html
  • 32. Gtkmozembed + flash
    • Flash plug-in library placed in specific user folder
    • $HOME/.mozilla/plugins
  • 33. Code Samples
    • aspn.activestate.com/ASPN/Cookbook/Python
    • pyshop
    • Other Important Issues
      • File Format Manipulation
      • Exceptions
      • Debugging and Testing
      • GUI Libraries (Cairo)
      • Unicode Howto
  • 34. THANK YOU