0
Python, A Charming Language




                      Python, A Charming Language

                                       ...
Python, A Charming Language




     Contents


      1 A Brief Intro to Python


      2 Application Domains


      3 Pl...
Python, A Charming Language
  A Brief Intro to Python
    The Definitions


     Two Definitions


             Python is on...
Python, A Charming Language
  A Brief Intro to Python
    The History


     The History for Python




             Guido...
Python, A Charming Language
  A Brief Intro to Python
    Features


     Features of Python I


             Simple:
    ...
Python, A Charming Language
  A Brief Intro to Python
    Features


     Features of Python II

             High-level L...
Python, A Charming Language
  A Brief Intro to Python
    Features


     Features of Python III

             Object-orie...
Python, A Charming Language
  Application Domains



     Many Application Domains



             GUI, network
          ...
Python, A Charming Language
  Application Domains
    GUI Libraries


     GUI Libraries




             Tcl/tk
         ...
Python, A Charming Language
  Application Domains
    Network Development


     Network Development



             socke...
Python, A Charming Language
  Application Domains
    Graphics and Images


     Graphics and Images




             PIL:...
Python, A Charming Language
  Application Domains
    Document Process


     Document Process




             epydoc
   ...
Python, A Charming Language
  Application Domains
    Game Development


     Game Development




             pygame
Python, A Charming Language
  Application Domains
    Web Development


     Web Development




             mod python +...
Python, A Charming Language
  Application Domains
    Scientific Computing


     Scientific Computing




             numa...
Python, A Charming Language
  Playing with Others



     Playing with Others




             COM
                    Pyt...
Python, A Charming Language
  To be Pythonic



     Zen of Python


          Beautiful is better than ugly.
          Ex...
Python, A Charming Language
  Some Demos



     Some Demos




             The slides followed will show some demos.
   ...
Python, A Charming Language
  Some Demos
    GUI Development


     wxPython: Python + wxWidgets


          import wx

  ...
Python, A Charming Language
  Some Demos
    GUI Development


     Screenshot




                              Figure: A...
Python, A Charming Language
  Some Demos
    GUI Development


     BOA Constructor




          Wiritten in Python
     ...
Python, A Charming Language
  Some Demos
    GUI Development


     Some Screenshots of BOA I




                        ...
Python, A Charming Language
  Some Demos
    GUI Development


     Some Screenshots of BOA II




                       ...
Python, A Charming Language
  Some Demos
    GUI Development


     Some Screenshots of BOA III




                      ...
Python, A Charming Language
  Some Demos
    GUI Development


     Some Screenshots of BOA IV




                       ...
Python, A Charming Language
  Some Demos
    Image Process


     PIL: Python Image Library




             Support many ...
Python, A Charming Language
  Some Demos
    Image Process


     Demo Code



          import Image
          import Ima...
Python, A Charming Language
  Some Demos
    Image Process


     Some Results
Python, A Charming Language
  Some Demos
    Scientific Computing


     SciPy: Scientific Tools for Python




            ...
Python, A Charming Language
  Some Demos
    Scientific Computing


     A Simple Program

          from enthought.chaco.w...
Python, A Charming Language
  Some Demos
    Scientific Computing


     The Result




                              Figur...
Python, A Charming Language
  Some Demos
    Game Demo


     PyGame




             A set of Python modules
            ...
Python, A Charming Language
  Networks Resources
    Forums and Groups


     Forums and Groups




             http://ww...
Python, A Charming Language
  Networks Resources
    Python Powered Websites


     Websites Powered by Python




       ...
Python, A Charming Language
  Networks Resources
    Python Powered Websites


     Q&A




                              ...
Python, A Charming Language
  Networks Resources
    Python Powered Websites


     Thanks




                           ...
Upcoming SlideShare
Loading in...5
×

20061216 python intro

2,266

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
2,266
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
73
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "20061216 python intro"

  1. 1. Python, A Charming Language Python, A Charming Language hzmangel@bupt Multimedia Technology Teaching and Researching Center BUPT December 13, 2006
  2. 2. Python, A Charming Language Contents 1 A Brief Intro to Python 2 Application Domains 3 Playing with Others 4 To be Pythonic 5 Some Demos 6 Networks Resources
  3. 3. Python, A Charming Language A Brief Intro to Python The Definitions Two Definitions Python is one of those rare languages which can claim to be both simple and powerful. You will find it easy to concentrate on the solution to your problem rather than having to concentrate on the programming language. Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective approach to object-oriented programming. Python’s elegant syntax and dynamic typing, together with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas on most platforms.
  4. 4. Python, A Charming Language A Brief Intro to Python The History The History for Python Guido van Rossum, the creator of the Python language. Xmas day in 1989. BBC show “Monty Python’s Flying Circus”
  5. 5. Python, A Charming Language A Brief Intro to Python Features Features of Python I Simple: Python is a simple and minimalistic language. Reading a good Python program feels almost like reading English, although very strict English. This pseudo-code nature of Python is one of its greatest strengths. Easy to Learn: Python is extremely easy to get started with, it has an extraordinarily simple syntax. Free and Open Source: Python is an example of a FOSS(Free and Open Source Software).
  6. 6. Python, A Charming Language A Brief Intro to Python Features Features of Python II High-level Language: When you write programs in Python, you do not have to worry about low-level details such as managing the memory used by your program, etc. Protable: Python has been ported to many platforms, All your Python programs can work on most of these platforms without requiring any changes at all, if you are careful enough to avoid any system-specific features. Interpreted: Python does not need compilation to a binary. It converts the source code to a bytecodes file.
  7. 7. Python, A Charming Language A Brief Intro to Python Features Features of Python III Object-oriented: Python supports procedure-oriented programming as well as object-oriented programming. Extensible: Python can use the code written in C/C++. Embeddable: You can embed Python within your C/C++ programs to give ’scripting’ capabilities for your program’s users. Extensive Libraries: The Python Standard Library is huge, and there are a huge number of high-quality libraries available for Python.
  8. 8. Python, A Charming Language Application Domains Many Application Domains GUI, network Graphic and image process Document process Game development Website Scientific computing ...
  9. 9. Python, A Charming Language Application Domains GUI Libraries GUI Libraries Tcl/tk wxPython PyGTK PyQT PySWT
  10. 10. Python, A Charming Language Application Domains Network Development Network Development socket module High-level network module SocketServer, BaseHTTPServer, CGIHTTPServer, ... email, ftplib, telnetlib, ... twisted jabber library Python-QQ
  11. 11. Python, A Charming Language Application Domains Graphics and Images Graphics and Images PIL: Python Imaging Library PyOpenGL Blender matplotlib yapgvb
  12. 12. Python, A Charming Language Application Domains Document Process Document Process epydoc ReportLab
  13. 13. Python, A Charming Language Application Domains Game Development Game Development pygame
  14. 14. Python, A Charming Language Application Domains Web Development Web Development mod python + Apache zope/plone karrigell cherrypy django
  15. 15. Python, A Charming Language Application Domains Scientific Computing Scientific Computing numarray numeric
  16. 16. Python, A Charming Language Playing with Others Playing with Others COM Python for Windows extensions .NET IronPython, Python for .NET Java Jython
  17. 17. Python, A Charming Language To be Pythonic Zen of Python Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts. Special cases aren’t special enough to break the rules. Although practicality beats purity. Errors should never pass silently. Unless explicitly silenced. In the face of ambiguity, refuse the temptation to guess. There should be one-- and preferably only one --obvious way to do it. Although that way may not be obvious at first unless you’re Dutch. Now is better than never. Although never is often better than *right* now. If the implementation is hard to explain, it’s a bad idea. If the implementation is easy to explain, it may be a good idea. Namespaces are one honking great idea -- let’s do more of those! -- by Tim Peters
  18. 18. Python, A Charming Language Some Demos Some Demos The slides followed will show some demos. Almost all of them are copy from the turtiol
  19. 19. Python, A Charming Language Some Demos GUI Development wxPython: Python + wxWidgets import wx class MyFrame(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title) class MyApp(wx.App): def OnInit(self): frame = MyFrame(None, -1, "This is a test") frame.Show(True) self.SetTopWindow(frame) return True def main(): app = MyApp(0) app.MainLoop() if __name__ == "__main__": main()
  20. 20. Python, A Charming Language Some Demos GUI Development Screenshot Figure: A simplewxPython app
  21. 21. Python, A Charming Language Some Demos GUI Development BOA Constructor Wiritten in Python A Python IDE and wxPython GUI Builder http://boa-constructor.sourceforge.net
  22. 22. Python, A Charming Language Some Demos GUI Development Some Screenshots of BOA I Figure: Frame Design
  23. 23. Python, A Charming Language Some Demos GUI Development Some Screenshots of BOA II Figure: Source Edit
  24. 24. Python, A Charming Language Some Demos GUI Development Some Screenshots of BOA III Figure: Debugger
  25. 25. Python, A Charming Language Some Demos GUI Development Some Screenshots of BOA IV Figure: UML View
  26. 26. Python, A Charming Language Some Demos Image Process PIL: Python Image Library Support many file format. Provide powerful image processing and graphics capabilities. Include filter, enchancement, ... Export PostScript file.
  27. 27. Python, A Charming Language Some Demos Image Process Demo Code import Image import ImageFilter import ImageEnchance im = Image.open("lenna.jpg") im_rotate = im.rotate(45) im_resize = im.resize(128, 128) im_crop = im.crop((0, 0, 256, 256)) im_trans = im.transpose(Image.FLIP_LEFT_RIGHT) r,g,b = im.split() im_edge = im.filter(ImageFilter.FIND_EDGES) im_enh = ImageEnhance.Contrast(im) enh.enhance(1.3).show().
  28. 28. Python, A Charming Language Some Demos Image Process Some Results
  29. 29. Python, A Charming Language Some Demos Scientific Computing SciPy: Scientific Tools for Python Pronounced Sigh Pie Core library is NumPy Provides many user-friendly and efficient numerical routines http://www.scipy.org
  30. 30. Python, A Charming Language Some Demos Scientific Computing A Simple Program from enthought.chaco.wx import plt from scipy import arange, optimize, special plt.figure() plt.hold() w = [] z = [] x = arange(0,10,.01) for k in arange(1,5,.5): y = special.jv(k,x) plt.plot(x,y) f = lambda x: -special.jv(k,x) x_max = optimize.fminbound(f,0,6) w.append(x_max) z.append(special.jv(k,x_max)) plt.plot(w,z, ’ro’) from scipy import interpolate t = interpolate.splrep(w, z, k=3) s_fit3 = interpolate.splev(x,t) plt.plot(x,s_fit3, ’g-’) t5 = interpolate.splrep(w, z, k=5) s_fit5 = interpolate.splev(x,t5) plt.plot(x,s_fit5, ’y-’)
  31. 31. Python, A Charming Language Some Demos Scientific Computing The Result Figure: Result of SciPy Demo
  32. 32. Python, A Charming Language Some Demos Game Demo PyGame A set of Python modules Designed for writing games Written on top of SDL library
  33. 33. Python, A Charming Language Networks Resources Forums and Groups Forums and Groups http://www.python.org http://python.cn http://www.woodpecker.org.cn http://groups.google.com/group/python-cn
  34. 34. Python, A Charming Language Networks Resources Python Powered Websites Websites Powered by Python http://moinmoin.wikiwikiweb.de http://www.douban.com
  35. 35. Python, A Charming Language Networks Resources Python Powered Websites Q&A Q&A
  36. 36. Python, A Charming Language Networks Resources Python Powered Websites Thanks Thanks
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×