Python Programming on WIN32

Overview

Python is growing in popularity; based on download statistics, there are now over 450,000 people using Python, and more than 150,000 people using Python on Windows. Use of the language has been growing at about 40% per year since 1995, and there is every reason to believe that growth will continue.Despite Python's increasing popularity on Windows, Python Programming on Win32 is the first book to demonstrate how to use it as a serious Windows development and administration tool. Unlike scripting on Unix, Windows ...

See more details below
Paperback (New Edition)
$48.89
BN.com price
(Save 18%)$59.99 List Price
Other sellers (Paperback)
  • All (18) from $7.99   
  • New (8) from $42.80   
  • Used (10) from $7.99   
Sending request ...

Overview

Python is growing in popularity; based on download statistics, there are now over 450,000 people using Python, and more than 150,000 people using Python on Windows. Use of the language has been growing at about 40% per year since 1995, and there is every reason to believe that growth will continue.Despite Python's increasing popularity on Windows, Python Programming on Win32 is the first book to demonstrate how to use it as a serious Windows development and administration tool. Unlike scripting on Unix, Windows scripting involves integrating a number of components, such as COM or the various mail and database APIs, with the Win32 programming interface. While experienced Windows C++ programmers can find their way through the various objects, most people need some guidance, and this book is it. It addresses all the basic technologies for common integration tasks on Windows, explaining both the Windows issues and the Python code you need to glue things together.Topics include:

  • The Python language and the PythonWin extensions
  • Building a GUI with COM
  • Adding a Macro language
  • Distributing the application
  • Client-side COM for output and data access
  • Integration with mail and other internet protocols
  • Managing users and drives
This is a vital and unique book. Python Programming on Win32 is an excellent presentation of Windows application development and a solid illustration of how to use Python in the Windows environment.

This is the first book to demonstrate how to use Python as a serious Windows development and administration tool. It addresses all the basic technologies for common integration tasks on Windows, explaining both the Windows issues and the Python code needed to glue things together.

Read More Show Less

Editorial Reviews

Booknews
Demonstrates how to use the Python programming language (an object- oriented scripting language) as a development and administrations tool for Win32. Focused on tasks rather than programming (although a brief tutorial is provided) the authors cover how Python works on Windows; the key integration technologies supported by Python on Windows; and examples of what Python can do with databases, email, Internet protocols, NT services, communications, and other areas. Annotation c. Book News, Inc., Portland, OR (booknews.com)
Read More Show Less

Product Details

  • ISBN-13: 9781565926219
  • Publisher: O'Reilly Media, Incorporated
  • Publication date: 2/28/2000
  • Edition description: New Edition
  • Edition number: 1
  • Pages: 674
  • Sales rank: 1,136,377
  • Product dimensions: 6.77 (w) x 9.47 (h) x 1.29 (d)

Meet the Author

Mark Hammond is an independent Microsoft Windows consultant working out of Melbourne, Australia. He studied computer science at the South Australian Institute of Technology (now the University of South Australia), and then worked with several large financial institutions in Australia. He started his consulting operation in 1995. Mark has produced many of the Windows extensions for Python, including PythonWin, Active Scripting, and Active Debugging support, and coauthored the COM framework and extensions. He is also a leading authority on Active Scripting and related technologies and has spoken on this subject at Microsofts three most recent Professional Developers conferences. Apart from being a father to his teenage daughter, having an interest in live music, and providing way-too-many free Python extensions, Mark has no life!

Andy Robinson is a London-based consultant specializing in business analysis, object-oriented design, and Windows development. He studied physics and philosophy, then Japanese studies at Oxford. He spent a year in advertising in Tokyo, two more in investment banking, and a long spell as the finance director of a startup in the sports industry. Observing that in all these positions he always ended up having to rewrite software, he moved to full-time computer consulting four years ago. He is currently helping one of the world's largest fund managers to internationalize their systems to handle Asian languages, developing Python systems for financial analysis, and reporting. Back when Andy had spare time, his passions were track and field, and rock climbing. Right now his two sons, Tim and Harry, are taking up all of his time.

Read More Show Less

Read an Excerpt


Chapter 1: Introduction

Case Studies of Python Deployment

Throughout this book we will talk about cases where Python has solved problems in the real world. Both of the authors use Python in their daily work and we will present a couple of examples how we are personally using Python to solve real world problems.

A Japanese Python?

One of the authors is currently working for a global investment company which is internationalizing its core applications to work with Far Eastern markets. The company's client platform is Windows, and core data is stored on Sybase servers and AS400 minicomputers, data flows back and forth among all three platforms continually. All three of these systems represent Japanese characters in totally different ways and work with different character sets. It was necessary not only to develop a library to convert between these encodings, but also to prove that it worked with 100% effectiveness for all the data that might be encountered in future years.

The first stage was to code up the conversions in Python, based on published algorithms and lookup tables. The interactive prompt let us look at the input and output strings very early on and get all of the details right working with single, short strings. We then developed classes to represent character sets' and character maps and fed in the published government character sets - very easy to do with Python's lists and dictionaries. We found subtle holes in published information and were able to correct for them. Having done this, we were able to prove that round-trip conversion was possible in many cases, and to identify the characters which would not survive a round trip in others.

An experienced C++ programmer then wrote a DLL to carry out String translations at high speed. Having a Python prototype allowed us to test the output very early on and compare the output. Python also generated test data sets with every valid character, something that would have taken months by hand. A Python wrapper was written around the DLL, and we wrote scripts to perform heavy-duty tests on it, feeding large customer databases through all possible conversions and back to the start. Naturally the tests uncovered bugs, but we found them all in two days rather than in months.

The DLL was then put to work converting large amounts of report data from mainframe to PC formats. Initially, a Python program used the DLL to perform translations. It would scan for files, decide what to do with them based on the names, break them up, and convert them a field at a time, and manage FTP sessions to send the data on to a destination database server. It also generated a web page for each file translated displaying its contents in an easy-to-read table, along with the results of basic integrity checks. This enabled testing of the data by users on two continents on a daily basis. When the data and algorithms were fully tested and known to be in their final shape, a fairly junior developer with six months experience wrote the eventual C++ program in under a week.

There's a Python on the Scoreboard!

A number of large sports stadiums in Australia (including the two largest with 100,000 person capacities) run custom scoreboard control software during all matches. This software is responsible for keeping and displaying the score for the game (including personal player information), and displaying other messages and advertising during the match. The information is displayed to the huge video scoreboards installed, as well as smaller strip scoreboards located around the ground and locally to the scorers PC using HTML.

The system runs on Windows NT computers, and needs to talk to a variety of custom software and hardware, including custom input device for score keeping and custom hardware to control the video and strip scoreboards. The system also needs to be able to read data during the game from an external database which provides detailed game statistics for each player.

The scoreboard software is written in C++ and Python. The C++ components of the system are responsible for keeping the match score, and maintaining the key score database. All of the scoreboard output functionality is written in Python, and exposes Python as a macro language for the scoreboard operators.

Each output device (for example, the video screen, strip scoreboard or HTML file) has a particular "language" that must be used to control the output. HTML, for example, uses <TAGS>, while the video scoreboard uses a formatting language somewhat similar to postscript. A common thread is that all output formats are text based.

A scheme has been devised that allows the scoreboard operator to embed Python code in the various layout formats. As the format is displayed, the Python code is executed to substitute the actual score. For example, the scoreboard operator may design a HTML page with code similar to

| <P>The player name is <I><%= player.Name %></I>

Anything within the <% tag is considered Python code, and the value substituted at runtime. Thus, this single HTML layout can be used to display the information for any player in the game.

The nature of Python has allowed this to provide features that would not be possible using other languages. One such feature is that the scoreboard operator is free to create new database fields for a player using Microsoft Access and use them in the scoreboard layouts immediately using player.FieldName syntax; thus the object model exposed to the user is actually partially controlled by the user. The use of Python also allows arbitrary code to be executed to control the formatting. For example, the scoreboard operator may use the following HTML to display the list of players in the home team:

|<p>Team <% = home.Name %>
|<% for player in home.Players: %>
|<P><%= player.Name %>
|<% #end %>

This has resulted in a situation programmers strive for, but see all too rarely; a system with enough flexibility that the users are able to do things with your software that you never dreamt could be done!

Other Python' Sightings in the Wild

To further dispel any impressions that Python is new, immature, or unsuited to critical applications, we've included a very small selection of projects and organizations using Python in the real world. These have been culled from a much longer list on the main Python web site., http:www.python.org/

  • NASA's Johnson Space Center uses Python as the scripting language for its Integrated Planning System.
  • UtraSeek Server, Infoseek's commercial web search engine, is implemented as a Python application, with some C extensions to provide primitive operations for fast, indexing and searching. The core product involves 11,000 lines of Python, and the user interface consists of 17,000 lines of Python-scripted HTML templates.
  • The Red Hat Commercial Linux distributions use Python for their installation procedures.
  • Caligari Corporation's 3D modeling and animation package, trueSpace 4, uses Python as a scripting language. Users can create custom modelling and animation effects, write interactive applications and develop game prototypes entirely inside trueSpace 4. We'll show you how to do something similar for your own applications in Part 2.
  • IBM's East Fishkill factory uses Python to control material entry. exit, and data collection for an entire semiconductor plant.
  • Scientists in the Theoretical Physics department of Los Alamos National Laboratory are using Python to control large-scale physics computations on massively parallel high-end servers and clusters. Python plays a central role in controlling simulations, performing data analysis and visualization.
  • SMHI, the Swedish civilian weather, hydrological, and oceanographic organization, uses Python extensively to acquire data, analyze it and present it to outside interests such as the media. They are developing a Python-based "Radar Analysis and Visualization Environment" to use with the national network of weather radars.
...
Read More Show Less

Table of Contents


Preface
Chapter 1: Introduction
Chapter 2: Python Language Review
Chapter 3: Python on Windows
Chapter 4: Integrated Development Environments for Python
Chapter 5: Introduction to Python and COM. List of Paragraph Styles
Chapter 6: A Financial Modeling Toolkit in Python
Chapter 7: Building a Graphical User Interface with COM
Chapter 8: Adding a "Macro Language"
Chapter 9: Integration with Excel
Chapter 10: Printed Output
Chapter 11: Distributing our Application with DCOM
Chapter 12: Advanced Python and COM
Chapter 13: Databases
Chapter 15: Using the basic Internet Protocols
Chapter 16: Windows NT Administration
Chapter 17: Processes and Files
Chapter 18: Windows NT Services. List of Paragraph Styles
Chapter 19: Communications
Chapter 20: GUI Development
Chapter 21: Active Scripting
Chapter 22: Extending and Embedding with Visual C+
Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)