You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(11) |
Sep
(10) |
Oct
(11) |
Nov
(8) |
Dec
(1) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(12) |
Feb
(7) |
Mar
(21) |
Apr
(5) |
May
(4) |
Jun
(1) |
Jul
(33) |
Aug
(5) |
Sep
(13) |
Oct
(16) |
Nov
(2) |
Dec
(6) |
2002 |
Jan
|
Feb
|
Mar
(6) |
Apr
(4) |
May
(1) |
Jun
|
Jul
(4) |
Aug
|
Sep
(1) |
Oct
|
Nov
(6) |
Dec
(1) |
2003 |
Jan
(1) |
Feb
(2) |
Mar
|
Apr
(6) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
From: A.M. K. <aku...@us...> - 2001-07-10 01:03:08
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv23314 Modified Files: python-dev.tex Log Message: Finish incomplete sentence Index: python-dev.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/python-dev.tex,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** python-dev.tex 2001/07/07 12:11:27 1.6 --- python-dev.tex 2001/07/10 01:03:05 1.7 *************** *** 14,23 **** This article shows you how to become one of the people who develop ! Python, meaning not just a person who develops \emph{using} ! Python, but a person who works on the core interpreter itself, and who contributes to the design of the language and the direction its ! development will take. This document will try to motivate you ! to take up Python development, and provides a high-level ! explanation of the development process, online forums, %====================================================================== --- 14,23 ---- This article shows you how to become one of the people who develop ! Python, meaning not just a person who develops \emph{using} Python, ! but a person who works on the core interpreter itself, and who contributes to the design of the language and the direction its ! development will take. This document will try to motivate you to take ! up Python development, explains the development process, and points ! you toward the online forums where discussion takes place. %====================================================================== |
From: Fred L. D. <fd...@us...> - 2001-07-08 01:41:47
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv25964 Modified Files: Makefile Log Message: Add a hint about how to generate the HTML so that the icons will be placed so they'll even work with the Web server at SourceForge. ;-) Index: Makefile =================================================================== RCS file: /cvsroot/py-howto/pyhowto/Makefile,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** Makefile 2000/11/23 08:03:35 1.5 --- Makefile 2001/07/08 01:41:44 1.6 *************** *** 35,39 **** % : %.tex ! $(MKHOWTO) --html $< tar -zcvf html/$*.tgz $* zip -r html/$*.zip $* --- 35,39 ---- % : %.tex ! $(MKHOWTO) --html --iconserver="." $< tar -zcvf html/$*.tgz $* zip -r html/$*.zip $* |
From: Fred L. D. <fd...@us...> - 2001-07-07 12:11:30
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv2178 Modified Files: python-dev.tex Log Message: Fix typo. Index: python-dev.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/python-dev.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** python-dev.tex 2001/07/07 11:22:07 1.5 --- python-dev.tex 2001/07/07 12:11:27 1.6 *************** *** 476,480 **** The author would like to thank the following people for offering ! suggestions on various drafts of this article: Aah Maruch, Skip Montanaro, Guido van Rossum. --- 476,480 ---- The author would like to thank the following people for offering ! suggestions on various drafts of this article: Aahz Maruch, Skip Montanaro, Guido van Rossum. |
From: A.M. K. <aku...@us...> - 2001-07-07 11:22:13
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv28866 Modified Files: python-dev.tex Log Message: Remove incomplete sentence Index: python-dev.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/python-dev.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** python-dev.tex 2001/07/07 03:00:19 1.4 --- python-dev.tex 2001/07/07 11:22:07 1.5 *************** *** 4,8 **** \title{Becoming a Python Developer} ! \release{0.02} \author{A.M. Kuchling} \authoraddress{\email{aku...@me...}} --- 4,8 ---- \title{Becoming a Python Developer} ! \release{0.03} \author{A.M. Kuchling} \authoraddress{\email{aku...@me...}} *************** *** 431,438 **** \email{python-dev} is an invitation-only list, though the list address ! accepts e-mail from non-members, and the archives are public. The ! goal of having the list be invitation only is simply to avoid having ! it turn into a Every two weeks, Michael Hudson writes summaries ! describing recent activity and discussions; summaries are archived at \url{http://starship.python.net/crew/mwh/summaries/}. --- 431,437 ---- \email{python-dev} is an invitation-only list, though the list address ! accepts e-mail from non-members, and the archives are public. Every ! two weeks, Michael Hudson writes summaries describing recent activity ! and discussions; summaries are archived at \url{http://starship.python.net/crew/mwh/summaries/}. *************** *** 477,482 **** The author would like to thank the following people for offering ! suggestions on various drafts of this article: Skip Montanaro, Guido ! van Rossum. \end{document} --- 476,481 ---- The author would like to thank the following people for offering ! suggestions on various drafts of this article: Aah Maruch, Skip ! Montanaro, Guido van Rossum. \end{document} |
From: A.M. K. <aku...@us...> - 2001-07-07 03:00:22
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv2263 Modified Files: python-dev.tex Log Message: Add section on devel. principles, listing Tim's 19 theses. Added conclusion and acknowledgement sections Index: python-dev.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/python-dev.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** python-dev.tex 2001/07/06 03:58:35 1.3 --- python-dev.tex 2001/07/07 03:00:19 1.4 *************** *** 10,13 **** --- 10,14 ---- \maketitle\tableofcontents + %====================================================================== \section{Introduction} *************** *** 20,23 **** --- 21,25 ---- explanation of the development process, online forums, + %====================================================================== \section{Why Work on Python?} *************** *** 145,148 **** --- 147,151 ---- \end{itemize} + %====================================================================== \section{How Python is Developed} *************** *** 162,201 **** - \subsection{The CVS Tree} - - In May 2000, the Python CVS tree was moved to SourceForge - (\url{http://www.sf.net}), and the bug tracking and patch submission tools - offered by SourceForge were also adopted at that time. Using - SourceForge's admittedly erratic project activity ranking, Python is - often among the 10 most active projects. - - Anyone can check out a read-only copy of the CVS tree by using - anonymous CVS. First, you'll need to run the following command to anonymously log in to the CVS server: - - \begin{verbatim} - cvs -d:pserver:ano...@cv...:/cvsroot/python login - \end{verbatim} - - Then, you can check out the tree: - - \begin{verbatim} - cvs -z3 \ - -d:pserver:ano...@cv...:/cvsroot/python \ - co python - \end{verbatim} - - Running \code{cvs -z3 update} will update the CVS tree to the most - recent version. Checkin messages and the accompanying diffs are sent - to a mailing list, \email{python-checkins}. Anyone can subscribe by - going to \url{http://mail.python.org/mailman/listinfo/python-checkins}. - - Write access to the Python CVS tree is not automatically granted, - though there's no formal process to go through to get it. If the - python-dev team knows who you are, whether through mailing list - discussion, having submitted patches, or some other interaction, then - you can ask for full CVS access. You'll need to have a SourceForge - ID, and provide it with your request. - - \subsection{PEPs} --- 165,168 ---- *************** *** 236,242 **** \subsection{Bug Tracking} ! To report a bug in Python, use the bug tracking tool at \url{http://sourceforge.net/tracker/?group_id=5470\&atid=105470}. Don't report bugs by posting them to a mailing list, or sending them to a particular developer as a private e-mail; most likely the bug --- 203,311 ---- + \subsection{Design Principles} + + Each software project in the world has its own culture and style, its + own approach to designing solutions to problems. Python has its own + style, of course, and if you've learnt the language then that style + has probably rubbed off on you to some extent. Python tries to keep + things simple, to be orthogonal but not too much so, to assist the + user as much as possible. + + In June 1999, Tim Peters channeled Guido and listed 19 guiding + principles for Python's design in a \newsgroup{comp.lang.python} + posting. The principles shouldn't be taken too seriously, as they're + not hard-and-fast constraints and for each rule you can probably list + instances where it's been broken. Still, no one has had much + disagreement with this list of design criteria. + + \begin{enumerate} + \item Beautiful is better than ugly. + + \item Explicit is better than implicit. + + \item Simple is better than complex. + + \item Complex is better than complicated. + + \item Flat is better than nested. + + \item Sparse is better than dense. + + \item Readability counts. + + \item Special cases aren't special enough to break the rules. + + \item Although practicality beats purity. + + \item Errors should never pass silently. + + \item Unless explicitly silenced. + + \item In the face of ambiguity, refuse the temptation to guess. + + \item There should be one --- and preferably only one --- obvious way + to do it. + + \item Although that way may not be obvious at first unless you're Dutch. + + \item Now is better than never. + + \item Although never is often better than \emph{right} now. + + \item If the implementation is hard to explain, it's a bad idea. + + \item If the implementation is easy to explain, it may be a good idea. + + \item Namespaces are one honking great idea --- let's do more of those! + + \end{enumerate} + + Don't take these 19 aphorisms too seriously --- tattooing them on your + body is probably a bad idea, for example --- but it's instructive to + contemplate them. Some parallels can be drawn to the guiding + principles of extreme programming, most notably the emphasis on ``Do + the simplest thing that can possibly work''. + + + \subsection{The CVS Tree} + + In May 2000, the Python CVS tree was moved to SourceForge + (\url{http://www.sf.net}), and the bug tracking and patch submission tools + offered by SourceForge were also adopted at that time. Using + SourceForge's admittedly erratic project activity ranking, Python is + often among the 10 most active projects. + + Anyone can check out a read-only copy of the CVS tree by using + anonymous CVS. First, you'll need to run the following command to anonymously log in to the CVS server: + + \begin{verbatim} + cvs -d:pserver:ano...@cv...:/cvsroot/python login + \end{verbatim} + + Then, you can check out the tree: + + \begin{verbatim} + cvs -z3 \ + -d:pserver:ano...@cv...:/cvsroot/python \ + co python + \end{verbatim} + + Running \code{cvs -z3 update} will update the CVS tree to the most + recent version. Checkin messages and the accompanying diffs are sent + to a mailing list, \email{python-checkins}. Anyone can subscribe by + going to \url{http://mail.python.org/mailman/listinfo/python-checkins}. + + Write access to the Python CVS tree is not automatically granted, + though there's no formal process to go through to get it. If the + python-dev team knows who you are, whether through mailing list + discussion, having submitted patches, or some other interaction, then + you can ask for full CVS access. You'll need to have a SourceForge + ID, and provide it with your request. + + \subsection{Bug Tracking} ! To report a bug in Python, use the bug tracking tool at ! \url{http://sourceforge.net/tracker/?group_id=5470\&atid=105470}. Don't report bugs by posting them to a mailing list, or sending them to a particular developer as a private e-mail; most likely the bug *************** *** 246,252 **** for a while, but before releases someone will go over the outstanding bugs and fix or close them. PEP 3, ``Guidelines for Handling Bug ! Reports'' (online at ! \url{http://www.python.org/peps/pep-0003.html}), explains the ! procedures for handling bugs once they've been reported. --- 315,320 ---- for a while, but before releases someone will go over the outstanding bugs and fix or close them. PEP 3, ``Guidelines for Handling Bug ! Reports'' (online at \url{http://www.python.org/peps/pep-0003.html}), ! explains the procedures for handling bugs once they've been reported. *************** *** 280,283 **** --- 348,352 ---- \end{itemize} + %====================================================================== \section{Mailing Lists} *************** *** 387,396 **** fond of it. %\section{Tour of the Python Distribution} % %XXX List significant directories and source files; point to relevant %documents... ! % XXX write a conclusion \end{document} --- 456,482 ---- fond of it. + %====================================================================== %\section{Tour of the Python Distribution} % %XXX List significant directories and source files; point to relevant %documents... + + %====================================================================== + \section{Conclusion} ! The development process of any large software system continuously ! shifts and evolves to match its environment, so this document will ! probably never be either complete or totally accurate. Please report ! inaccuracies, errors, or suggestions for additional topics to me at ! \email{aku...@me...}. I hope that this guide convinces ! you that Python is a worthwhile project to spend time on, and give you ! enough information to begin contributing. ! ! %====================================================================== ! \section{Acknowledgements} ! ! The author would like to thank the following people for offering ! suggestions on various drafts of this article: Skip Montanaro, Guido ! van Rossum. \end{document} |
From: A.M. K. <aku...@us...> - 2001-07-06 03:58:38
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv13196 Modified Files: python-dev.tex Log Message: Add paragraph about working on the standard library. Add a sentence. Index: python-dev.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/python-dev.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** python-dev.tex 2001/07/06 03:42:49 1.2 --- python-dev.tex 2001/07/06 03:58:35 1.3 *************** *** 93,99 **** writing extensions or making changes. \end{itemize} ! There are a few different implementations of Python. \begin{itemize} --- 93,108 ---- writing extensions or making changes. + Note, however, that it's possible to do a lot even if you don't know + C at all. Working on the portions of the standard library that are + written in Python is just as valuable for the project and is equally + educational for you. Plus, programming in Python is much more + pleasant than programming in C, because you get nicely formatted + tracebacks instead of nasty core dumps and protection faults. + + % XXX should mention somewhere that you don't need to be on Unix, either. \end{itemize} ! There are a few different implementations of Python. A quick ! overview of them follows. \begin{itemize} |
From: A.M. K. <aku...@us...> - 2001-07-06 03:42:52
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv7437 Modified Files: python-dev.tex Log Message: First bunch of rewrites, following GvR's feedback Index: python-dev.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/python-dev.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** python-dev.tex 2001/07/06 02:30:12 1.1 --- python-dev.tex 2001/07/06 03:42:49 1.2 *************** *** 4,8 **** \title{Becoming a Python Developer} ! \release{0.01} \author{A.M. Kuchling} \authoraddress{\email{aku...@me...}} --- 4,8 ---- \title{Becoming a Python Developer} ! \release{0.02} \author{A.M. Kuchling} \authoraddress{\email{aku...@me...}} *************** *** 13,20 **** This article shows you how to become one of the people who develop ! Python. This means not just a person who develops \emph{using} Python, but a person who works on the core interpreter itself, and who contributes to the design of the language and the direction its ! development will take. \section{Why Work on Python?} --- 13,22 ---- This article shows you how to become one of the people who develop ! Python, meaning not just a person who develops \emph{using} Python, but a person who works on the core interpreter itself, and who contributes to the design of the language and the direction its ! development will take. This document will try to motivate you ! to take up Python development, and provides a high-level ! explanation of the development process, online forums, \section{Why Work on Python?} *************** *** 27,32 **** for your purposes. ! \item You like hacking on language interpreters. ! (XXX is that a bit snarky? not sure I phrased that well...) \item You want to gain experience as a developer on an open source --- 29,34 ---- for your purposes. ! \item You like hacking on sizable software systems in general, or ! language interpreters in particular. \item You want to gain experience as a developer on an open source *************** *** 62,66 **** \item Python is over 10 years old, and its development process is ! quite (XXX elaborate? evolved? mature?). There's a public CVS repository. There's a coding standard for both C and Python code. There's a framework for writing test suites. There's infrastructure --- 64,68 ---- \item Python is over 10 years old, and its development process is ! quite mature at this point. There's a public CVS repository. There's a coding standard for both C and Python code. There's a framework for writing test suites. There's infrastructure *************** *** 72,107 **** \item The most important skill Python can teach is the delicate ! skill of working in a diverse group. Python is developed by a group ! of about 30 people, about 10 of whom are very active and make the ! bulk of actual check-ins, and 20 of whom make more occasional ! checkins and provide opinions and advice. People oscillate between ! the more active and less active groups in an irregular way, ! depending on their free time, availability, and current interests. ! You'll have to learn who's the right person to ask each question, ! how to convince the other developers of the usefulness of a patch, ! and how to offer helpful criticism. \item C programmers will find that the C source code for the Python interpreter is clearly written and easy to dive into. It's relatively easy to familiarize yourself with the code, and to begin ! writing extensions or making changes. \end{itemize} ! XXX should something be written about CPython / JPython / Stackless / ! Python.NET? I only know about CPython. \section{How Python is Developed} ! Guido van Rossum has the title of Benevolent Dictator For Life, or ! BDFL. In theory the BDFL makes all the decisions about what goes in ! to Python and what doesn't. In practice, often the BDFL will defer to ! someone else's expertise in a specialized domain; for example, Tim ! Peters is the resident master of floating point arcana, Jeremy Hylton ! usually wrestles the Python compiler, and so forth. Modules in the ! standard library are also often the responsibility of a particular ! individual who's the first choice to review patches or fix bugs in it, ! but anyone can modify any line of code at any time, and simple, ! obviously correct fixes can be applied by anyone. --- 74,154 ---- \item The most important skill Python can teach is the delicate ! skill of working in a diverse group. There's a core group of around ! 30 developers, roughly 10 of whom are very active and make the bulk ! of actual check-ins, and roughly 20 of whom make more occasional ! checkins and provide opinions and advice, but lots of people outside ! this core group contribute significantly, too. Developers oscillate ! between the more active and less active groups in an irregular way, ! depending on their free time, availability, and current interests; ! sometimes other things have to take precedence over Python hacking. ! ! To work with this large and dispersed group, you'll have to learn ! who's the right person to ask each question, how to convince the ! other developers of the usefulness of a patch, how to offer helpful ! criticism, and how to take criticism. \item C programmers will find that the C source code for the Python interpreter is clearly written and easy to dive into. It's relatively easy to familiarize yourself with the code, and to begin ! writing extensions or making changes. \end{itemize} ! There are a few different implementations of Python. + \begin{itemize} + + \item The first + implementation, and the one in widest use, is the implementation + written in C. This is the implementation usually meant when people + refer to ``Python'', but it's called CPython when people want to + distinguish between it and some other implementation. + + \item Stackless Python is a fork of CPython, but not one that diverges + very far from the main tree. Its author, Christian Tismer, rewrote + the main interpreter loop of CPython to minimize its use of the C + stack; in particular, calling a Python function doesn't occupy any + more room on the C stack. This means that, while CPython can only + recurse a few thousand levels deep before filling up the C stack and + crashing, Stackless can recurse to an unlimited depth. Stackless is + also significantly faster than CPython (around 10\%), supports + continuations and lightweight threads, and has found a community of + highly skilled users, who use it to do things such as writing + massively-multiplayer online game. The Stackless Python home page is + at \url{http://www.stackless.com}. + + \item Jython is a reimplementation of Python, written in Java instead + of C. (It was originally named JPython, but the name had to be + changed for stupid trademark reasons.) Jython compiles Python code + into Java bytecodes, and can seamlessly use any Java class directly + from Python code, with no need to write an extension module first, as + is necessary for CPython. The Jython home page is at + \url{http://www.jython.org}. + + \item Python for .NET is an experimental implementation of Python for + the .NET Framework. Currently this seems to be a research effort, + because while compiling Python to .NET bytecodes has been implemented, + and the resulting code works, making the resulting code \emph{fast} + seems to be a difficult problem. See the Python.NET home page, at + \url{http://www.activestate.com/Initiatives/NET/Research.html}, to get + an overview of the current state of progress. + + \end{itemize} + \section{How Python is Developed} ! Guido van Rossum is the project's lead developer. In recognition of ! this role, he's sometimes jokingly called the Benevolent Dictator For ! Life, or BDFL; the acronym is occasionally used in \email{python-dev} ! postings, especially in contexts such as ``that will require a BDFL ! pronouncement''. In theory the BDFL makes all the decisions about ! what goes in to Python and what doesn't. In practice, often Guido ! will defer to someone else's expertise in a specialized domain; for ! example, Tim Peters is the resident master of floating point arcana, ! Jeremy Hylton usually wrestles the Python compiler, and so forth. ! Modules in the standard library are also often the responsibility of a ! particular individual who's the first choice to review patches or fix ! bugs in it, but anyone can modify any line of code at any time, and ! simple, obviously correct fixes can be applied by anyone. *************** *** 173,179 **** All the PEPs are available online at ! \url{http://python.sourceforge.net/peps/}. PEP 1, ``PEP Purpose and Guidelines'' (online at ! \url{http://python.sourceforge.net/peps/pep-0001.html}), explains the purpose of PEPs, their life cycle, and the prescribed format for a PEP. Read it before beginning to write a PEP. --- 220,226 ---- All the PEPs are available online at ! \url{http://www.python.org/peps/}. PEP 1, ``PEP Purpose and Guidelines'' (online at ! \url{http://www.python.org/peps/pep-0001.html}), explains the purpose of PEPs, their life cycle, and the prescribed format for a PEP. Read it before beginning to write a PEP. *************** *** 191,195 **** bugs and fix or close them. PEP 3, ``Guidelines for Handling Bug Reports'' (online at ! \url{http://python.sourceforge.net/peps/pep-0003.html}), explains the procedures for handling bugs once they've been reported. --- 238,242 ---- bugs and fix or close them. PEP 3, ``Guidelines for Handling Bug Reports'' (online at ! \url{http://www.python.org/peps/pep-0003.html}), explains the procedures for handling bugs once they've been reported. *************** *** 203,216 **** to be checked in. ! Context diffs are preferred, so generate the patch using \code{diff ! -C2}. (XXX is that correct?) Patches to C code should follow ! Python's standard style, described at \url{XXX}. (XXX Is there a ! description of it anywhere?) If you're using Emacs to edit your C ! code, cc-mode supports Python's standard style; run the 'c-set-style' ! command and select the 'python' style. Code written in Python should ! follow the style in Guido's style guide, at ! \url{http://www.python.org/doc/essays/styleguide.html}. \section{Mailing Lists} --- 250,274 ---- to be checked in. ! Some conventions that should be followed when preparing a patch are: + \begin{itemize} + \item Context diffs are preferred, so generate the patch using \code{diff + -c}. + + \item Patches to C code should follow Python's standard style, + described in PEP 7, ``Style Guide for C Code'', at + \url{http://www.python.org/peps/pep-0007.html}. If you're + using Emacs to edit your C code, cc-mode supports Python's standard + style; run the \code{c-set-style} command and select the 'python' style. + + \item For patches to Jython, the standard formatting and indentation style + for Java code should be followed. + + \item Code written in Python should follow the style in Guido's style guide, + described in PEP 8, ``Style Guide for Python Code'', + (\url{http://www.python.org/peps/pep-0008.html}). + \end{itemize} + \section{Mailing Lists} *************** *** 222,231 **** The most general and most high-traffic list is \email{python-list} (\url{mail.python.org/mailman/listinfo/python-list}), which is ! gatewayed to the Usenet newsgroup \newsgroup{comp.lang.python}. Pretty ! much anything Python-related is fair game for discussion, and the ! group is fairly tolerant of off-topic digressions. It's quite possible to have a reasoned discussion of programming languages other than Python; in the past there have been lengthy and informative ! threads about Lisp, floating point, and XXX, for example. \email{python-list} mostly has discussion of development in Python, --- 280,290 ---- The most general and most high-traffic list is \email{python-list} (\url{mail.python.org/mailman/listinfo/python-list}), which is ! gatewayed to the Usenet newsgroup \newsgroup{comp.lang.python}. ! Pretty much anything Python-related is fair game for discussion, and ! the group is fairly tolerant of off-topic digressions. It's quite possible to have a reasoned discussion of programming languages other than Python; in the past there have been lengthy and informative ! threads about Lisp, floating point, and the principles of good ! software design, for example. \email{python-list} mostly has discussion of development in Python, *************** *** 236,248 **** frequently-made ones that are always rejected, but there have been other times when suggestions turned into a PEP, and then into a new ! feature. (XXX Argh! I had an example of this, but forgot it!) Rudeness and personal attacks, even in reaction to blatant flamebait, ! are strongly frowned upon. Either ignore such postings, quietly plonk ! the offending poster in your killfile or mail filters, or write a ! sharp but still-polite response, but resist the urge to flame back. ! Generally \email{python-list} is a high-signal, low-noise group. The ! traffic is also quite high, currently running at around 150 posts per ! day. \subsection{python-announce} --- 295,309 ---- frequently-made ones that are always rejected, but there have been other times when suggestions turned into a PEP, and then into a new ! feature. % XXX Argh! I had an example of this, but forgot it! Rudeness and personal attacks, even in reaction to blatant flamebait, ! are strongly frowned upon. People may strongly disagree on an issue, ! but usually discussion remains civil, though vehement. In case of an ! actual flamebait posting, you can ignore it, quietly plonk the ! offending poster in your killfile or mail filters, or write a sharp ! but still-polite response, but at all costs resist the urge to flame ! back. Generally \email{python-list} is a high-signal, low-noise ! group. The traffic is also quite high, currently running at around ! 150 posts per day. \subsection{python-announce} *************** *** 307,320 **** concise way to express opinions in a straw poll, and the result isn't binding in any way. The BDFL will take note of the reaction to a ! proposal, but is free to ignore it. (While the BDFL can ignore community reaction, I can't think of an instance where he's actually ! done so. Perhaps the closest one is the \code{print >>} statement, ! where everyone was roughly evenly divided between liking it and hating ! it. It was added to the language in Python 2.0.) ! ! \section{Tour of the Python Distribution} ! XXX List significant directories and source files; point to relevant ! documents... \end{document} --- 368,387 ---- concise way to express opinions in a straw poll, and the result isn't binding in any way. The BDFL will take note of the reaction to a ! proposal, but is free to ignore it. While the BDFL \emph{can} ignore community reaction, I can't think of an instance where he's actually ! done so in the face of united disapproval by the community. The ! closest case to that might be the \code{print >>} statement, where ! everyone turned out to be divided 50/50 between liking it and hating ! it. Guido exercised his right to decide, and the feature was added to ! the language in Python 2.0. Some people still hate it; some people ! who argued against it, such as this author, have now grown sneakily ! fond of it. ! ! %\section{Tour of the Python Distribution} ! % ! %XXX List significant directories and source files; point to relevant ! %documents... ! % XXX write a conclusion \end{document} |
From: A.M. K. <aku...@us...> - 2001-07-06 02:30:15
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv17580 Added Files: python-dev.tex Log Message: Initial checkin of guide to becoming a Python developer ***** Error reading new file[Errno 2] No such file or directory: 'python-dev.tex' |
From: A.M. K. <aku...@us...> - 2001-06-27 20:32:15
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv3852 Modified Files: python-22.tex Log Message: Add more items that need to be written about Index: python-22.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/python-22.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** python-22.tex 2001/05/19 19:35:46 1.2 --- python-22.tex 2001/06/27 20:32:12 1.3 *************** *** 42,45 **** --- 42,59 ---- %====================================================================== + \section{PEP 255: Simple Generators} + + XXX + + \begin{seealso} + + \seepep{255}{Simple Generators}{Written by Neil Schemenauer, + Tim Peters, Magnus Lie Hetland. Implemented mostly by Neil + Schemenauer, with fixes from the Python Labs crew, mostly by GvR and + Tim Peters.} + + \end{seealso} + + %====================================================================== \section{PEP 252: Type and Class Changes} *************** *** 52,55 **** --- 66,79 ---- \end{seealso} + + %====================================================================== + \section{Unicode Changes} + + XXX I have to figure out what the changes mean to users. + (--enable-unicode configure switch) + + References: http://mail.python.org/pipermail/i18n-sig/2001-June/001107.html + and following thread. + %====================================================================== |
From: Eric S. R. <es...@us...> - 2001-05-31 07:02:24
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv15612 Modified Files: curses.tex Log Message: Correct a case error. Index: curses.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/curses.tex,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** curses.tex 2001/05/14 15:24:49 1.14 --- curses.tex 2001/05/31 07:02:21 1.15 *************** *** 342,346 **** containing a foreground (or text) colour and a background colour. You can get the attribute value corresponding to a colour pair with the ! \function{COLOR_PAIR()} function; this can be bitwise-OR'ed with other attributes such as \constant{A_REVERSE}, but again, such combinations are not guaranteed to work on all terminals. --- 342,346 ---- containing a foreground (or text) colour and a background colour. You can get the attribute value corresponding to a colour pair with the ! \function{color_pair()} function; this can be bitwise-OR'ed with other attributes such as \constant{A_REVERSE}, but again, such combinations are not guaranteed to work on all terminals. *************** *** 349,353 **** \begin{verbatim} ! stdscr.addstr( "Pretty text", curses.COLOR_PAIR(1) ) stdscr.refresh() \end{verbatim} --- 349,353 ---- \begin{verbatim} ! stdscr.addstr( "Pretty text", curses.color_pair(1) ) stdscr.refresh() \end{verbatim} *************** *** 378,382 **** \begin{verbatim} ! stdscr.addstr(0,0, "RED ALERT!", curses.COLOR_PAIR(1) ) \end{verbatim} --- 378,382 ---- \begin{verbatim} ! stdscr.addstr(0,0, "RED ALERT!", curses.color_pair(1) ) \end{verbatim} |
From: A.M. K. <aku...@us...> - 2001-05-19 19:35:53
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv29277 Modified Files: python-22.tex Log Message: Add another item Index: python-22.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/python-22.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** python-22.tex 2001/05/05 16:37:29 1.1 --- python-22.tex 2001/05/19 19:35:46 1.2 *************** *** 74,77 **** --- 74,80 ---- \item XXX C API: Reorganization of object calling + \item XXX .encode(), .decode() string methods. Interesting new codecs such + as zlib. + %Original log message: |
From: Eric S. R. <es...@us...> - 2001-05-14 15:24:53
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv27048 Modified Files: curses.tex Log Message: Typo fixes. Index: curses.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/curses.tex,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** curses.tex 2001/04/10 17:35:31 1.13 --- curses.tex 2001/05/14 15:24:49 1.14 *************** *** 118,122 **** \begin{verbatim} ! stdscr.keypad(1) \end{verbatim} --- 118,122 ---- \begin{verbatim} ! curses.keypad(1) \end{verbatim} *************** *** 125,129 **** \begin{verbatim} ! curses.nobreak(); curses.keypad(0); curses.echo() \end{verbatim} --- 125,129 ---- \begin{verbatim} ! curses.nocbreak(); curses.keypad(0); curses.echo() \end{verbatim} |
From: A.M. K. <aku...@us...> - 2001-05-05 16:37:33
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv17478 Added Files: python-22.tex Log Message: Skeletal version; I'm checking this in now so I can keep a list of changes, but don't plan on actually writing any text until, ooh, say, July or thereabouts. ***** Error reading new file[Errno 2] No such file or directory: 'python-22.tex' |
From: Fred L. D. <fd...@us...> - 2001-04-23 16:54:53
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv29333 Modified Files: regex.tex Log Message: Fix re.VERSION-modified RE; "#" as part of the pattern was not escaped. Closes SF bug #416374. Wrap some wide paragraphs. Remove extraneous "%" characters from otherwise blank lines after verbatim environments, except in a couple of places where we needed to bow to font-lock. ;-( Index: regex.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/regex.tex,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** regex.tex 2000/07/28 02:06:27 1.8 --- regex.tex 2001/04/23 16:54:49 1.9 *************** *** 70,74 **** We'll start by learning about the simplest possible regular ! expressions. Since regular expressions are used to operate on strings, we'll start with the most common task: matching characters. For a detailed explanation of the computer science underlying regular --- 70,75 ---- We'll start by learning about the simplest possible regular ! expressions. Since regular expressions are used to operate on ! strings, we'll start with the most common task: matching characters. For a detailed explanation of the computer science underlying regular *************** *** 90,100 **** devoted to discussing various metacharacters and what they do. ! Here's a complete list of the metacharacters; their meanings will be discussed ! in the rest of this HOWTO. \begin{verbatim} . ^ $ * + ? { [ \ | ( ) \end{verbatim} ! % The first metacharacter we'll look at is \samp{[}; it's used for specifying a character class, which is a set of characters that you --- 91,102 ---- devoted to discussing various metacharacters and what they do. ! Here's a complete list of the metacharacters; their meanings will be ! discussed in the rest of this HOWTO. \begin{verbatim} . ^ $ * + ? { [ \ | ( ) \end{verbatim} ! % $ ! The first metacharacter we'll look at is \samp{[}; it's used for specifying a character class, which is a set of characters that you *************** *** 107,114 **** RE would be \regexp{[a-z]}. ! Metacharacters are not active inside classes. For example, \regexp{[akm\$]} ! will match any of the characters \character{a}, \character{k}, ! \character{m}, or \character{\$}; \character{\$} is usually a metacharacter, but inside a character class it's stripped ! of its special nature. You can match the characters not within a range by \dfn{complementing} --- 109,117 ---- RE would be \regexp{[a-z]}. ! Metacharacters are not active inside classes. For example, ! \regexp{[akm\$]} will match any of the characters \character{a}, ! \character{k}, \character{m}, or \character{\$}; \character{\$} is ! usually a metacharacter, but inside a character class it's stripped of ! its special nature. You can match the characters not within a range by \dfn{complementing} *************** *** 134,150 **** \item[\code{\e d}]Matches any decimal digit; this is equivalent to the class \regexp{[0-9]}. ! % \item[\code{\e D}]Matches any non-digit character; this is equivalent to the class \verb|[^0-9]|. ! % \item[\code{\e s}]Matches any whitespace character; this is equivalent to the class \regexp{[ \e t\e n\e r\e f\e v]}. ! % \item[\code{\e S}]Matches any non-whitespace character; this is equivalent to the class \verb|[^ \t\n\r\f\v]|. ! % \item[\code{\e w}]Matches any alphanumeric character; this is equivalent to the class \regexp{[a-zA-Z0-9_]}. ! % \item[\code{\e W}]Matches any non-alphanumeric character; this is equivalent to the class \verb|[^a-zA-Z0-9_]|. --- 137,153 ---- \item[\code{\e d}]Matches any decimal digit; this is equivalent to the class \regexp{[0-9]}. ! \item[\code{\e D}]Matches any non-digit character; this is equivalent to the class \verb|[^0-9]|. ! \item[\code{\e s}]Matches any whitespace character; this is equivalent to the class \regexp{[ \e t\e n\e r\e f\e v]}. ! \item[\code{\e S}]Matches any non-whitespace character; this is equivalent to the class \verb|[^ \t\n\r\f\v]|. ! \item[\code{\e w}]Matches any alphanumeric character; this is equivalent to the class \regexp{[a-zA-Z0-9_]}. ! \item[\code{\e W}]Matches any non-alphanumeric character; this is equivalent to the class \verb|[^a-zA-Z0-9_]|. *************** *** 272,276 **** <re.RegexObject instance at 80b4150> \end{verbatim} ! % \function{re.compile()} also accepts an optional \var{flags} argument, used to enable various special features and syntax --- 275,279 ---- <re.RegexObject instance at 80b4150> \end{verbatim} ! \function{re.compile()} also accepts an optional \var{flags} argument, used to enable various special features and syntax *************** *** 281,285 **** >>> p = re.compile('ab*', re.IGNORECASE) \end{verbatim} ! % The RE is passed to \function{re.compile()} as a string. REs are handled as strings because regular expressions aren't --- 284,288 ---- >>> p = re.compile('ab*', re.IGNORECASE) \end{verbatim} ! The RE is passed to \function{re.compile()} as a string. REs are handled as strings because regular expressions aren't *************** *** 379,383 **** <re.RegexObject instance at 80c3c28> \end{verbatim} ! % Now, you can try matching various strings against the RE \regexp{[a-z]+}. An empty string shouldn't match at all, since --- 382,386 ---- <re.RegexObject instance at 80c3c28> \end{verbatim} ! Now, you can try matching various strings against the RE \regexp{[a-z]+}. An empty string shouldn't match at all, since *************** *** 392,396 **** None \end{verbatim} ! % Now, let's try it on a string that it should match, such as \samp{tempo}. In this case, \method{match()} will return a --- 395,399 ---- None \end{verbatim} ! Now, let's try it on a string that it should match, such as \samp{tempo}. In this case, \method{match()} will return a *************** *** 403,407 **** <re.MatchObject instance at 80c4f68> \end{verbatim} ! % Now you can query the \class{MatchObject} for information about the matching string. \class{MatchObject} instances also have several --- 406,410 ---- <re.MatchObject instance at 80c4f68> \end{verbatim} ! Now you can query the \class{MatchObject} for information about the matching string. \class{MatchObject} instances also have several *************** *** 425,429 **** (0, 5) \end{verbatim} ! % \method{group()} returns the substring that was matched by the RE. \method{start()} and \method{end()} return the starting and --- 428,432 ---- (0, 5) \end{verbatim} ! \method{group()} returns the substring that was matched by the RE. \method{start()} and \method{end()} return the starting and *************** *** 445,449 **** (4, 11) \end{verbatim} ! % In actual programs, the most common style is to store the \class{MatchObject} in a variable, and then check if it was --- 448,452 ---- (4, 11) \end{verbatim} ! In actual programs, the most common style is to store the \class{MatchObject} in a variable, and then check if it was *************** *** 458,462 **** print 'No match' \end{verbatim} ! % \subsection{Module-Level Functions} --- 461,465 ---- print 'No match' \end{verbatim} ! \subsection{Module-Level Functions} *************** *** 475,479 **** <re.MatchObject instance at 80c5978> \end{verbatim} ! % Under the hood, these functions simply produce a \class{RegexObject} for you and call the appropriate method on it. They also store the --- 478,482 ---- <re.MatchObject instance at 80c5978> \end{verbatim} ! Under the hood, these functions simply produce a \class{RegexObject} for you and call the appropriate method on it. They also store the *************** *** 498,502 **** starttagopen = re.compile( ... ) \end{verbatim} ! % (I generally prefer to work with the compiled object, even for one-time uses, but few people will be as much of a purist about this --- 501,505 ---- starttagopen = re.compile( ... ) \end{verbatim} ! (I generally prefer to work with the compiled object, even for one-time uses, but few people will be as much of a purist about this *************** *** 594,598 **** \begin{verbatim} charref = re.compile(r""" ! &# # Start of a numeric entity reference (?P<char> [0-9]+[^0-9] # Decimal form --- 597,601 ---- \begin{verbatim} charref = re.compile(r""" ! &\# # Start of a numeric entity reference (?P<char> [0-9]+[^0-9] # Decimal form *************** *** 602,606 **** """, re.VERBOSE) \end{verbatim} ! % Without the verbose setting, the RE would look like this: \begin{verbatim} --- 605,609 ---- """, re.VERBOSE) \end{verbatim} ! Without the verbose setting, the RE would look like this: \begin{verbatim} *************** *** 609,613 **** "|x[0-9a-fA-F]+[^0-9a-fA-F])") \end{verbatim} ! % In the above example, Python's automatic concatenation of string literals has been used to break up the RE into smaller pieces, but it's still more difficult to --- 612,616 ---- "|x[0-9a-fA-F]+[^0-9a-fA-F])") \end{verbatim} ! In the above example, Python's automatic concatenation of string literals has been used to break up the RE into smaller pieces, but it's still more difficult to *************** *** 639,643 **** \begin{list}{}{} ! % \item[\regexp{|}] Alternation, or the ``or'' operator. --- 642,646 ---- \begin{list}{}{} ! \item[\regexp{|}] Alternation, or the ``or'' operator. *************** *** 651,655 **** To match a literal \character{|}, use \regexp{\e|}, or enclose it inside a character class, as in \regexp{[|]}. ! % \item[\regexp{\^}] Matches at the beginning of lines. Unless the \constant{MULTILINE} flag has been set, this will only match at the --- 654,658 ---- To match a literal \character{|}, use \regexp{\e|}, or enclose it inside a character class, as in \regexp{[|]}. ! \item[\regexp{\^}] Matches at the beginning of lines. Unless the \constant{MULTILINE} flag has been set, this will only match at the *************** *** 670,674 **** use \regexp{\e\^}, or enclose it inside a character class, as in \regexp{[{\e}\^]}. ! % \item[\regexp{\$}] Matches at the end of lines, which is defined as either the end of the string, or any location followed by a newline --- 673,677 ---- use \regexp{\e\^}, or enclose it inside a character class, as in \regexp{[{\e}\^]}. ! \item[\regexp{\$}] Matches at the end of lines, which is defined as either the end of the string, or any location followed by a newline *************** *** 683,690 **** <re.MatchObject instance at 80adfa8> \end{verbatim} ! % ! To match a literal \character{\$}, ! use \regexp{\e\$}, or enclose it inside a character class, as in \regexp{[\$]}. ! % \item[\regexp{\e A}] Matches only at the start of the string. When not in \constant{MULTILINE} mode, \regexp{\e A} and \regexp{\^} are effectively --- 686,694 ---- <re.MatchObject instance at 80adfa8> \end{verbatim} ! % $ ! ! To match a literal \character{\$}, use \regexp{\e\$}, or enclose it ! inside a character class, as in \regexp{[\$]}. ! \item[\regexp{\e A}] Matches only at the start of the string. When not in \constant{MULTILINE} mode, \regexp{\e A} and \regexp{\^} are effectively *************** *** 693,699 **** \regexp{\^} may match at several locations inside the string (anywhere following a newline character). ! % \item[\regexp{\e Z}]Matches only at the end of the string. ! % \item[\regexp{\e b}] Word boundary. This is a zero-width assertion that matches only at the --- 697,703 ---- \regexp{\^} may match at several locations inside the string (anywhere following a newline character). ! \item[\regexp{\e Z}]Matches only at the end of the string. ! \item[\regexp{\e b}] Word boundary. This is a zero-width assertion that matches only at the *************** *** 714,718 **** None \end{verbatim} ! % There are two subtleties you should remember when using this special sequence. First, this is the worst collision between Python's string --- 718,722 ---- None \end{verbatim} ! There are two subtleties you should remember when using this special sequence. First, this is the worst collision between Python's string *************** *** 731,743 **** <re.MatchObject instance at 80c3ee0> \end{verbatim} ! % Second, inside a character class, where there's no use for this assertion, \regexp{\e b} represents the backspace character, for compatibility with Python's string literals. ! % \item[\regexp{\e B}] Another zero-width assertion, this is the opposite of \regexp{\e b}, only matching when the current position is not at a word boundary. ! % \end{list} --- 735,747 ---- <re.MatchObject instance at 80c3ee0> \end{verbatim} ! Second, inside a character class, where there's no use for this assertion, \regexp{\e b} represents the backspace character, for compatibility with Python's string literals. ! \item[\regexp{\e B}] Another zero-width assertion, this is the opposite of \regexp{\e b}, only matching when the current position is not at a word boundary. ! \end{list} *************** *** 927,931 **** 'Lots' \end{verbatim} ! % Named groups are handy because they let you use easily-remembered names, instead of having to remember numbers. Here's an example RE --- 931,935 ---- 'Lots' \end{verbatim} ! Named groups are handy because they let you use easily-remembered names, instead of having to remember numbers. Here's an example RE *************** *** 940,944 **** r'"') \end{verbatim} ! % It's obviously much easier to retrieve \code{m.group('zonem')}, instead of having to remember to retrieve group 9. --- 944,948 ---- r'"') \end{verbatim} ! It's obviously much easier to retrieve \code{m.group('zonem')}, instead of having to remember to retrieve group 9. *************** *** 997,1000 **** --- 1001,1005 ---- \verb|.*[.][^b].*$| + % $ First attempt: Exclude \samp{bat} by requiring that the first *************** *** 1007,1014 **** The expression gets messier when you try to patch up the first solution by requiring one of the following cases to match: the first ! character of the extension isn't ! \samp{b}; the second character isn't \samp{a}; or the third ! character isn't \samp{t}. This accepts \samp{foo.bar} and rejects ! \samp{autoexec.bat}, but it requires a three-letter extension, and doesn't accept \samp{sendmail.cf}. Another bug, so we'll complicate the pattern again in an effort to fix it. \regexp{.*[.]([\^b].?.?|.[\^a]?.?|..?[\^t]?)\$} --- 1012,1021 ---- The expression gets messier when you try to patch up the first solution by requiring one of the following cases to match: the first ! character of the extension isn't \samp{b}; the second character isn't ! \samp{a}; or the third character isn't \samp{t}. This accepts ! \samp{foo.bar} and rejects \samp{autoexec.bat}, but it requires a ! three-letter extension, and doesn't accept \samp{sendmail.cf}. ! Another bug, so we'll complicate the pattern again in an effort to fix ! it. \regexp{.*[.]([\^b].?.?|.[\^a]?.?|..?[\^t]?)\$} *************** *** 1068,1072 **** returned as the final element of the list. In the following example, the delimiter will be any sequence of non-alphanumeric characters. ! % \begin{verbatim} >>> p = re.compile(r'\W+') --- 1075,1079 ---- returned as the final element of the list. In the following example, the delimiter will be any sequence of non-alphanumeric characters. ! \begin{verbatim} >>> p = re.compile(r'\W+') *************** *** 1076,1080 **** ['This', 'is', 'a', 'test, short and sweet, of split().'] \end{verbatim} ! % Sometimes you're not only interested in what the text between delimiters is, but also need to know what the delimiter was. If --- 1083,1087 ---- ['This', 'is', 'a', 'test, short and sweet, of split().'] \end{verbatim} ! Sometimes you're not only interested in what the text between delimiters is, but also need to know what the delimiter was. If *************** *** 1090,1094 **** ['This', '... ', 'is', ' ', 'a', ' ', 'test', '.', ''] \end{verbatim} ! % The module-level function \function{re.split()} adds the RE to be used as the first argument, but is otherwise the same. --- 1097,1101 ---- ['This', '... ', 'is', ' ', 'a', ' ', 'test', '.', ''] \end{verbatim} ! The module-level function \function{re.split()} adds the RE to be used as the first argument, but is otherwise the same. *************** *** 1131,1135 **** 'colour socks and red shoes' \end{verbatim} ! % Empty matches are replaced only when not they're not adjacent to a previous match. --- 1138,1142 ---- 'colour socks and red shoes' \end{verbatim} ! Empty matches are replaced only when not they're not adjacent to a previous match. *************** *** 1140,1144 **** '-a-b-d-' \end{verbatim} ! % If \var{replacement} is a string, any backslash escapes in it are processed. That is, \samp{\e n} is converted to a single newline --- 1147,1151 ---- '-a-b-d-' \end{verbatim} ! If \var{replacement} is a string, any backslash escapes in it are processed. That is, \samp{\e n} is converted to a single newline *************** *** 1155,1159 **** 'subsection{First} subsection{second}' \end{verbatim} ! % In addition to character escapes and backreferences as described above, \samp{\e g<name>} will use the substring matched by the group --- 1162,1166 ---- 'subsection{First} subsection{second}' \end{verbatim} ! In addition to character escapes and backreferences as described above, \samp{\e g<name>} will use the substring matched by the group *************** *** 1176,1180 **** 'subsection{First}' \end{verbatim} ! % \var{replacement} can also be a function, which gives you even more powerful control. If \var{replacement} is a function, the function is --- 1183,1187 ---- 'subsection{First}' \end{verbatim} ! \var{replacement} can also be a function, which gives you even more powerful control. If \var{replacement} is a function, the function is *************** *** 1183,1187 **** information to compute the desired replacement string and return it. For example: ! % \begin{verbatim} >>> def hexrepl( match ): --- 1190,1194 ---- information to compute the desired replacement string and return it. For example: ! \begin{verbatim} >>> def hexrepl( match ): *************** *** 1194,1198 **** 'Call 0xffd2 for printing, 0xc000 for user code.' \end{verbatim} ! % When using the module-level \function{re.sub()} function, the pattern is passed as the first argument. The pattern may be a string or a --- 1201,1205 ---- 'Call 0xffd2 for printing, 0xc000 for user code.' \end{verbatim} ! When using the module-level \function{re.sub()} function, the pattern is passed as the first argument. The pattern may be a string or a *************** *** 1260,1264 **** None \end{verbatim} ! % On the other hand, \module{search()} will scan forward through the string, reporting the first match it finds. --- 1267,1271 ---- None \end{verbatim} ! On the other hand, \module{search()} will scan forward through the string, reporting the first match it finds. *************** *** 1270,1274 **** (2, 7) \end{verbatim} ! % Sometimes you'll be tempted to keep using \function{re.match()}, and just add \regexp{.*} to the front of your RE. Resist this tempation, --- 1277,1281 ---- (2, 7) \end{verbatim} ! Sometimes you'll be tempted to keep using \function{re.match()}, and just add \regexp{.*} to the front of your RE. Resist this tempation, *************** *** 1303,1307 **** <html><head><title>Title</title> \end{verbatim} ! % The RE matches the \character{<} in \samp{<html>}, and the \regexp{.*} consumes the rest of the string. There's still more left --- 1310,1314 ---- <html><head><title>Title</title> \end{verbatim} ! The RE matches the \character{<} in \samp{<html>}, and the \regexp{.*} consumes the rest of the string. There's still more left *************** *** 1324,1328 **** <html> \end{verbatim} ! % \subsection{Not using re.VERBOSE} --- 1331,1335 ---- <html> \end{verbatim} ! \subsection{Not using re.VERBOSE} *************** *** 1356,1360 **** """, re.VERBOSE) \end{verbatim} ! % This is far more readable than: --- 1363,1368 ---- """, re.VERBOSE) \end{verbatim} ! % $ ! This is far more readable than: *************** *** 1362,1366 **** pat = re.compile(r"\s*(?P<header>[^:]+)\s*:(?P<value>.*?)\s*$") \end{verbatim} ! % \section{Feedback} --- 1370,1375 ---- pat = re.compile(r"\s*(?P<header>[^:]+)\s*:(?P<value>.*?)\s*$") \end{verbatim} ! % $ ! \section{Feedback} *************** *** 1383,1387 **** substring matched by the group \emph{cannot} be retrieved after performing a match or referenced later in the pattern. ! % \item[\code{(?P<\var{name}>...)}] Similar to regular parentheses, but the substring matched by the group is accessible via the symbolic group --- 1392,1396 ---- substring matched by the group \emph{cannot} be retrieved after performing a match or referenced later in the pattern. ! \item[\code{(?P<\var{name}>...)}] Similar to regular parentheses, but the substring matched by the group is accessible via the symbolic group *************** *** 1396,1403 **** or \code{m.end('id')}, and also by name in pattern text (e.g. \regexp{(?P=id)}) and replacement text (e.g. \code{\e g<id>}). ! % \item[\code{(?P=\var{name})}] Matches whatever text was matched by the earlier group named \var{name}. - % \item[\code{(?=...)}] Matches if \regexp{...} matches next, but doesn't --- 1405,1411 ---- or \code{m.end('id')}, and also by name in pattern text (e.g. \regexp{(?P=id)}) and replacement text (e.g. \code{\e g<id>}). ! \item[\code{(?P=\var{name})}] Matches whatever text was matched by the earlier group named \var{name}. \item[\code{(?=...)}] Matches if \regexp{...} matches next, but doesn't *************** *** 1405,1409 **** example, \regexp{Isaac (?=Asimov)} will match \code{'Isaac~'} only if it's followed by \code{'Asimov'}. ! % \item[\code{(?!...)}] Matches if \regexp{...} doesn't match next. This is a negative lookahead assertion. For example, --- 1413,1417 ---- example, \regexp{Isaac (?=Asimov)} will match \code{'Isaac~'} only if it's followed by \code{'Asimov'}. ! \item[\code{(?!...)}] Matches if \regexp{...} doesn't match next. This is a negative lookahead assertion. For example, |
From: A.M. K. <aku...@us...> - 2001-04-16 02:27:57
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv15870 Modified Files: python-21.tex Log Message: Update document for the actual 2.1rc1 Index: python-21.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/python-21.tex,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -r1.24 -r1.25 *** python-21.tex 2001/04/12 04:11:21 1.24 --- python-21.tex 2001/04/16 02:27:53 1.25 *************** *** 627,636 **** \begin{itemize} ! \item Ka-Ping Yee contributed two new modules: \module{inspect.py}, a module for ! getting information about live Python code, and \module{pydoc.py}, a ! module for interactively converting docstrings to HTML or text. ! As a bonus, \file{Tools/scripts/pydoc}, which is now automatically ! installed, uses \module{pydoc.py} to display documentation given a Python module, package, or class name. For example, ! \samp{pydoc xml.dom} displays the following: \begin{verbatim} --- 627,637 ---- \begin{itemize} ! \item Ka-Ping Yee contributed two new modules: \module{inspect.py}, a ! module for getting information about live Python code, and ! \module{pydoc.py}, a module for interactively converting docstrings to ! HTML or text. As a bonus, \file{Tools/scripts/pydoc}, which is now ! automatically installed, uses \module{pydoc.py} to display ! documentation given a Python module, package, or class name. For ! example, \samp{pydoc xml.dom} displays the following: \begin{verbatim} *************** *** 651,654 **** --- 652,656 ---- \end{verbatim} + \file{pydoc} also includes a Tk-based interactive help browser. \file{pydoc} quickly becomes addictive; try it out! *************** *** 719,722 **** --- 721,729 ---- \item Support for raw socket access has been added to the \module{socket} module, contributed by Grant Edwards. + + \item The \module{pstats} module now contains a simple interactive + statistics browser for displaying timing profiles for Python programs, + invoked when the module is run as a script. Contributed by + Eric S.\ Raymond. \item A new implementation-dependent function, \function{sys._getframe(\optional{depth})}, |
From: Fred L. D. <fd...@us...> - 2001-04-12 04:11:24
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv15103 Modified Files: python-21.tex Log Message: Markup nit: use \envvar to mark environment variables. Index: python-21.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/python-21.tex,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -r1.23 -r1.24 *** python-21.tex 2001/04/12 03:37:19 1.23 --- python-21.tex 2001/04/12 04:11:21 1.24 *************** *** 512,516 **** \exception{ImportError} if no such file is found, so \code{import file} will not import a module named \samp{FILE.PY}. Case-insensitive ! matching can be requested by setting the PYTHONCASEOK environment variable before starting the Python interpreter. --- 512,516 ---- \exception{ImportError} if no such file is found, so \code{import file} will not import a module named \samp{FILE.PY}. Case-insensitive ! matching can be requested by setting the \envvar{PYTHONCASEOK} environment variable before starting the Python interpreter. |
From: A.M. K. <aku...@us...> - 2001-04-12 03:37:22
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv9128 Modified Files: python-21.tex Log Message: Explain popitem() Add Unixware 7 port Ready for RC1 Minor rewrites Index: python-21.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/python-21.tex,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -r1.22 -r1.23 *** python-21.tex 2001/03/26 13:34:53 1.22 --- python-21.tex 2001/04/12 03:37:19 1.23 *************** *** 6,10 **** \title{What's New in Python 2.1} ! \release{0.07} \author{A.M. Kuchling} \authoraddress{\email{am...@bi...}} --- 6,10 ---- \title{What's New in Python 2.1} ! \release{0.99} \author{A.M. Kuchling} \authoraddress{\email{am...@bi...}} *************** *** 14,23 **** \section{Introduction} ! {\large This document is a draft, and is subject to change until ! the final version of Python 2.1 is released. Currently it is up to date ! for Python 2.1 beta 2. Please send any comments, bug reports, or ! questions, no matter how minor, to \email{am...@bi...}. } ! It's that time again... time for a new Python release, version 2.1. One recent goal of the Python development team has been to accelerate the pace of new releases, with a new release coming every 6 to 9 --- 14,24 ---- \section{Introduction} ! {\large This document is a draft, and is subject to change until the ! final version of Python 2.1 is released. Currently it is up to date ! for Python 2.1 release candidate~1. Please send any comments, bug ! reports, or questions, no matter how minor, to ! \email{am...@bi...}. } ! It's that time again... time for a new Python release, Python 2.1. One recent goal of the Python development team has been to accelerate the pace of new releases, with a new release coming every 6 to 9 *************** *** 37,42 **** more details about any new feature that particularly interests you. ! Currently 2.1 is available in a beta release, and the final release is ! planned for April 2001. %====================================================================== --- 38,42 ---- more details about any new feature that particularly interests you. ! The final release of Python 2.1 is planned for April 2001. %====================================================================== *************** *** 796,807 **** For a fuller discussion of the line I/O changes, see the python-dev ! summary for January 1-15, 2001. \item A new method, \method{popitem()}, was added to dictionaries to enable destructively iterating through the contents of a dictionary; ! this can be faster for large dictionaries because XXX. \code{D.popitem()} removes a random \code{(\var{key}, \var{value})} ! pair from the dictionary and returns it as a 2-tuple. This was ! implemented mostly by Tim Peters and Guido van Rossum, after a suggestion and preliminary patch by Moshe Zadka. --- 796,809 ---- For a fuller discussion of the line I/O changes, see the python-dev ! summary for January 1-15, 2001 at ! \url{http://www.amk.ca/python/dev/2001-01-1.html}. \item A new method, \method{popitem()}, was added to dictionaries to enable destructively iterating through the contents of a dictionary; ! this can be faster for large dictionaries because there's no need to ! construct a list containing all the keys or values. \code{D.popitem()} removes a random \code{(\var{key}, \var{value})} ! pair from the dictionary~\code{D} and returns it as a 2-tuple. This ! was implemented mostly by Tim Peters and Guido van Rossum, after a suggestion and preliminary patch by Moshe Zadka. *************** *** 845,849 **** \item Some new ports were contributed: MacOS X (by Steven Majewski), ! Cygwin (by Jason Tishler); RISCOS (by Dietmar Schwertberger). \end{itemize} --- 847,852 ---- \item Some new ports were contributed: MacOS X (by Steven Majewski), ! Cygwin (by Jason Tishler); RISCOS (by Dietmar Schwertberger); Unixware~7 ! (by Billy G. Allie). \end{itemize} |
From: Fred L. D. <fd...@us...> - 2001-04-10 17:35:34
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv18936 Modified Files: curses.tex Log Message: Use appropriate markup for multiple authors; LaTeX's \author is not additive; the second occurrance was causing the first author to be dropped. Index: curses.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/curses.tex,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** curses.tex 2001/01/16 15:49:00 1.12 --- curses.tex 2001/04/10 17:35:31 1.13 *************** *** 5,12 **** \release{2.0} ! \author{A.M. Kuchling} ! \authoraddress{\email{am...@bi...}} ! \author{Eric S. Raymond} ! \authoraddress{\email{es...@th...}} \begin{document} --- 5,10 ---- \release{2.0} ! \author{A.M. Kuchling \and\ Eric S. Raymond} ! \authoraddress{\email{am...@bi...}, \email{es...@th...}} \begin{document} |
From: lucas b. <lb...@us...> - 2001-03-29 22:23:44
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv6083 Removed Files: wxpython.tex Log Message: this file is now useless. |
From: lucas b. <lb...@us...> - 2001-03-29 22:13:46
|
Update of /cvsroot/py-howto/pyhowto/wxPython-howto In directory usw-pr-cvs1:/tmp/cvs-serv4461/wxPython-howto Added Files: abstract.tex appendix.tex avdtopics.tex conclusion.tex contributors.tex editapp1.eps editapp2.eps editapp3.eps forms.tex helloworld.eps helloworld.tex installation.tex introduction.tex prerequisites.tex resources.tex smalleditor.tex wxPython-howto.tex Log Message: I have split the file into bits ***** Error reading new file[Errno 2] No such file or directory: 'abstract.tex' ***** Error reading new file[Errno 2] No such file or directory: 'appendix.tex' ***** Error reading new file[Errno 2] No such file or directory: 'avdtopics.tex' ***** Error reading new file[Errno 2] No such file or directory: 'conclusion.tex' ***** Error reading new file[Errno 2] No such file or directory: 'contributors.tex' --- NEW FILE --- ÅÐÓÆt= ÿÀ }SÓDäå¸h7ßÚñþïîªÚößøÒ}LÈ'ÑÆb9 Ų¶µUUô¿ia³%û=,[ôz¤Xîÿ %%Creator: Adobe Photoshop Version 5.5 %%Title: editapp1.eps %%CreationDate: Wed Mar 28 2001 18:52:45 %%BoundingBox: 0 0 150 75 %%HiResBoundingBox: 0 0 149.9455 74.9728 %%SuppressDotGainCompensation %%EndComments %%BeginProlog %%EndProlog %%BeginSetup %%EndSetup [...2781 lines suppressed...] 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 %%EndBinary grestore end % Image Trailer grestore grestore % EPS grestore --- NEW FILE --- ÅÐÓÆÆZ ÿÀ O¿þGÇírzgYÿ ìe¸?Ó±ÍkÙu³nÆäì·ìßÏzOWqâå!)ä©Ö±âýIìô.úùõ^¸me4íkv4Øíoú/c·±1úýõT ½Ù:¼{qnÆ{±2.iµÔ9®mMeVíûN[·îʧéµt½qù ÁÛr÷µ»c+ô·ïÈ-gæ®jÌlø¾û°ÝF?NÌ«sò+½Î}ÎÅ}Í9Ïö·Ï{ÒSÿÑìó $}>?ãmY}aä`ÉÃêÒÖI>×=í¥·êã7~?©ëU¾úêûÕÆãu.¥Õú=YƧ×é·Ðmý/©mì}ïÒ}mjÏüÜêßùjÏý gþIN.Pô²ié-Ç0ÚË,¬ êfÀûè7Õ·ôF«ÿ JRI$I$¥$I)üÓ¬?!Y]OþKÍÿ ÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷õ+øþõõøV+÷+ûú+++++ûù++++÷+++++++÷++++ùú+V++++÷++++÷+÷+++÷¬ø++÷+++÷++÷öùú+÷+û+ûúö+÷V++++÷÷++++÷++÷+++÷++++++÷+++÷+++++÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷÷+÷+÷÷öö÷øýõö÷V÷÷+ûù÷øùù+¬ú+ùúø+ùVVúøùù+÷úú+ù¬øø+ùúø+Vøú+÷÷+Vúùö¬ú÷+øúù+V÷÷øú¬÷++¬ùûùùV+V+ùù+÷+øúúø+ùV+ùú÷+øúúøVù+ùúø+ùú÷úø+÷÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷÷+÷÷÷÷öøø+øþõö÷ù+÷+ûùVýûV¬VûûVþV¬ûûûûù+ù¬VüVûûVýûûú+÷+ùûVüûVûûVüø+üúýø+÷¬¬ûûùüVûûù++û¬ûVþVúûûVûüû¬+úûVýûûûø+÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷+÷÷÷÷÷öøù÷+Výõö÷V÷÷+ûùV¬öùûû÷ûùõûû+ü+ûVVû÷ûüý÷üûùõû¬ø÷¬÷+÷ùû¬ûü÷öüûõùûüø+ü+÷+ü÷ûûõüøVø++ûùõûû+¬÷öüûõùûûø÷ûýüö¬+ûú+÷+÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷÷÷÷+÷÷öøùö+÷øýõöøV÷++ûùùûöùûü÷ûùõûü+¬÷ûùùûüV+ü÷üûùõûû+ø¬++ùû+úûûøöüûõùûü÷ø¬ûö÷÷¬÷ùöûûøVø÷+ûùõûü+¬øöüûõùü÷ûú+ûü+¬÷ûù+÷÷÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷÷+÷+÷÷÷öøùöøø+øþõö÷V+÷+ûùùûöúûüøVûûùü+¬÷ûùùûùûûýVûùüVûûV¬+ø¬+÷øû¬üüûøûûVúûûýVûV++úúûúöûüùûûù++û¬ùü+úûûøüûüøVûýü+¬÷ûú+÷÷+÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷+÷÷÷÷÷÷öøùöøù÷+øýõö÷ù÷÷+ø÷÷ø+øøø÷+Vúø+V÷ø÷ø÷÷ø+ùùù+øøV+Vúø÷V+÷V÷÷+øúùøVùù÷+øúV++ùøø÷øø+÷÷Vøø+øøø+Vù+÷+ûûùø+V÷+ùú÷+ùüø÷+Vúùøø÷ø÷øø+÷+÷÷+÷+÷+÷+÷+÷+÷+÷+÷+÷+÷+÷+÷+÷+÷+÷+÷+÷+÷÷÷÷÷+÷÷÷öøùöøùö+÷øþõö÷V÷÷÷+÷÷+÷+÷+÷÷+++÷+÷+÷+÷÷+÷+++÷+÷+÷+++÷+÷÷+÷÷÷+++++++÷÷+++÷÷+÷+÷+÷÷÷+++÷÷+÷+÷++÷÷+úVö÷÷+÷÷+++Vüû÷+÷÷+++++÷+÷++÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷+÷+÷÷÷÷+öøùöøùöøø+øýõöøù+÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷+÷÷÷÷÷÷÷÷÷÷÷+÷+÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷öøùöøùöøù÷+øþõö÷öõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõõöø÷+ø÷+ø÷÷÷øýõõ÷++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++÷++÷++÷++++øþö÷øøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøVøøVý¬þýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþþýþýþýýÿ%!PS-Adobe-3.0 EPSF-3.0 %%Creator: Adobe Photoshop Version 5.5 %%Title: editapp2.eps %%CreationDate: Wed Mar 28 2001 18:56:17 %%BoundingBox: 0 0 174 103 %%HiResBoundingBox: 0 0 173.9368 102.7127 %%SuppressDotGainCompensation %%EndComments %%BeginProlog [...4283 lines suppressed...] 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 %%EndBinary grestore end % Image Trailer grestore grestore % EPS grestore --- NEW FILE --- ÅÐÓÆð ÿÀ ¿Ñ*Å~--µ.}L sÍgÜ[_Ñ©ô]g±ýÿ KÆÒIO²$¼m$û"KÆÒIO²(d1gõ]ÿ ÷ø÷ø÷ø÷ø÷ø÷ø÷ø÷ø÷ø÷ø÷ø÷ø÷ø÷ø÷ø÷ø÷ø÷ø÷ø÷ø÷ø÷ø÷ø÷ø÷VVøVøVøVøVøüø UUðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïïðïïðïïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïðïïðïõ+++úüüú++VýÕ ÷÷÷÷÷øû++öúú+øúV+úVVüúúVVüüøúV+÷+÷÷+÷÷÷÷÷÷+øýø+÷÷÷+÷+÷÷øý +÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷+÷÷÷÷+÷÷+÷÷÷÷÷+÷÷÷÷÷÷+÷÷+÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷+÷÷÷÷÷÷÷+÷÷÷÷+øý %%Creator: Adobe Photoshop Version 5.5 %%Title: editapp3.eps %%CreationDate: Wed Mar 28 2001 22:08:58 %%BoundingBox: 0 0 459 267 %%HiResBoundingBox: 0 0 458.8334 266.9031 %%SuppressDotGainCompensation %%EndComments %%BeginProlog %%EndProlog %%BeginSetup [...27519 lines suppressed...] FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 %%EndBinary grestore end % Image Trailer grestore grestore % EPS grestore ***** Error reading new file[Errno 2] No such file or directory: 'forms.tex' --- NEW FILE --- ÅÐÓÆ ÿÀ «évõ>µ]VWQxÈÃYe8ÿ %%Creator: Adobe Photoshop Version 5.5 %%Title: helloworld.eps %%CreationDate: Wed Mar 28 2001 17:40:26 %%BoundingBox: 0 0 241 167 %%HiResBoundingBox: 0 0 241 167 %%SuppressDotGainCompensation %%EndComments %%BeginProlog %%EndProlog %%BeginSetup [...5199 lines suppressed...] 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000 %%EndBinary grestore end % Image Trailer grestore grestore % EPS grestore ***** Error reading new file[Errno 2] No such file or directory: 'helloworld.tex' ***** Error reading new file[Errno 2] No such file or directory: 'installation.tex' ***** Error reading new file[Errno 2] No such file or directory: 'introduction.tex' ***** Error reading new file[Errno 2] No such file or directory: 'prerequisites.tex' ***** Error reading new file[Errno 2] No such file or directory: 'resources.tex' ***** Error reading new file[Errno 2] No such file or directory: 'smalleditor.tex' ***** Error reading new file[Errno 2] No such file or directory: 'wxPython-howto.tex' |
From: lucas b. <lb...@us...> - 2001-03-29 21:59:06
|
Update of /cvsroot/py-howto/pyhowto/wxPython-howto In directory usw-pr-cvs1:/tmp/cvs-serv2245/wxPython-howto Log Message: Directory /cvsroot/py-howto/pyhowto/wxPython-howto added to the repository |
From: lucas b. <lb...@us...> - 2001-03-29 19:31:18
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv2665 Modified Files: wxpython.tex Log Message: work in progress Index: wxpython.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/wxpython.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** wxpython.tex 2001/03/28 18:57:43 1.1 --- wxpython.tex 2001/03/29 19:31:14 1.2 *************** *** 1,398 **** ! % ================================================================================== ! % ! % HOWTO : wxPython, a cross-platform GUI Library ! % $ Id $ ! % ================================================================================== ! ! \documentclass{howto} ! \usepackage{epsfig} ! \input epsf ! ! \title{wxPython, a cross-platform GUI Library } ! \release{0.03} ! \author{The wxPython community} ! \authoraddress{\email{luc...@ec...} } ! \begin{document} ! \maketitle ! \ifhtml ! \chapter*{Front Matter\label{front}} ! \fi ! % ================================================================================== ! \begin{abstract} ! \noindent ! In this document, we present a cross-platform GUI ( Graphical User Interface) called wxPython. We shall be using wxPython 2.2.5 . We shall also introduce a few advanced topics that make the strength of wxPython. ! ! This document is available in several formats, including PostScript, ! PDF, HTML and plain ASCII, from the Python HOWTO page at ! \url{http://py-howto.sourceforge.net/}. ! ! \end{abstract} ! % ================================================================================== ! ! \tableofcontents ! ! % ================================================================================== ! ! \section{What is wxPython ? } ! WxPython ranks amongst the toolkits that enable writing cross-platform GUI-applications like \module{pyQT}, \module{pyGTK}, or \module{Tkinter}. But under windows, and unlike \module{Tkinter} or \module{pyGTK}, a \module{wxPython} Application has a look and feel very similar to what you would get with an application using microsoft native GUI, MFC \footnote{Microsoft Foundation Classes}. This is because wxPython is a fine layer over the native GUI classes. Besides this, wxPython is very simple to learn and takes advantage of the possibilities Python is offering. By instance, events handling is particularly nice under wxPython. ! In fact, wxPython is simply (?) Python Bindings to a C++ Library called wxWindows; dating back from 1992 \footnote{It's almost as old as Tkinter - which dates back from 1990}, wxWindows is now a very stable, efficient, object-oriented library running (smoothly) on Windows, Unix ( GTK/Motif/Lesstif) and soon Macintosh. ! ! % ================================================================================== ! \section{Prerequisites} ! We assume the reader has sufficient knowledge of Python and is familiar with classes and objects in Python\footnote{ If you are not already a Pythonista,you might want to have a look at \url{http://www.crosswinds.net/~agauld } }. No other knowledge is required. ! ! % ================================================================================== ! ! \section{Installation} ! ! \subsection{Windows} ! Installation under windows is especially simple: Run the installer you can get from \url{http://www.wxpython.org/download.php} and follow the instructions. ! ! \subsection{Linux - Redhat} ! You can find RPMs for Redhat (they are working just fine with Mandrake though), at the address \url{http://www.wxpython.org/download.php}. ! ! \subsection{Linux - Building from the source} ! TO DO ! % TO BE CONTINUED. ! % ================================================================================== ! ! \section{A first application - Hello, world} ! As is traditional, we are first going to write a Small "Hello, world" application. ! Here is the code: ! % Old code: ! % from wxPython.wx import * ! % class HelloApp(wxApp): ! % def OnInit(self): ! % frame = wxFrame(None,-1,"Hello, world") ! % frame.Show(true) ! % self.SetTopWindow(frame) ! % return true ! % app = HelloApp() ! % app.MainLoop() ! % New code: ! \begin{verbatim} ! from wxPython.wx import wxPySimpleApp, wxFrame ! app = wxPySimpleApp() ! frame = wxFrame(None, -1, "Hello World") ! frame.Show(1) ! app.MainLoop() ! \end{verbatim} ! \begin{figure} ! \epsfig{file=helloworld.eps} ! \caption{Hello, World application} ! \end{figure} ! ! % After importing \module{wxPython} GUI, we derive our new application from wxPython's original application abstract class. This lets use rewrite the \method{OnInit} method. ! % This is where the real work is: ! % We instantiate a new \keyword{Frame}\footnote{A frame in wxPython is a window with its titlebar, reduction and close buttons, etc... it can be a normal application window, a MDI parent frame, etc...} with the constructor \class{wxFrame}. We make this \keyword{Frame} appear by "showing" it. Eventually, we tell the application that this frame is going to be its Topwindow ( so that the application terminates when you close the frame). ! % Explaination: ! After importing \module{wxPython} GUI, we instantiate a new \class{wxPySimpleApp} and a new \class{wxFrame}. A frame in wxPython is a window with its titlebar, reduction and close buttons, etc... \footnote{it can be a normal application window, a MDI parent frame, etc...} We make this \keyword{Frame} appear by "showing" it. Eventually, we start the application's \method{MainLoop} whose role ! % ================================================================================== ! ! \section{Pushing it a bit further - Marvels of wxPython} ! In this section, we shall build a little editor. This is mostly to convince you of the inner capabilities and of the simplicity of use of wxPython. If you are already convinced you might as well want to read first \emph{Advanced Topics}. ! ! \subsection{Adding the edit component} ! The first step is to add a new edit component. The code herein appears, by courtesy of Mr Michael Roberts\footnote{ See Also his excellent article in Useful resources }. ! ! \begin{verbatim} ! from wxPython.wx import * ! class MainWindow(wxFrame): ! """ We simply derive a new class of Frame. """ ! def __init__(self,parent,id,title): ! wxFrame.__init__(self,parent,-4, title, size = ( 200,100), ! style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE) ! self.control = wxTextCtrl(self, 1, style=wxTE_MULTILINE) ! self.Show(true) ! app = wxPySimpleApp() ! frame = MainWindow(None, -1, "Sample editor") ! frame.Show(1) ! app.MainLoop() ! \end{verbatim} ! %class EditApp(wxApp): ! % def OnInit(self): ! % frame = MainWindow(None,-1,"A sample edit ctrl") ! % frame.Show(true) ! % self.SetTopWindow(frame) ! % return true ! %app = EditApp() ! %app.MainLoop() ! ! As you can see, it is not very difficult: All we have to do is to derive \class{wxFrame} and then overload its \method{__init__} method. In this method, we declare a new \class{wxTextCtrl}, which is a simple text edit control. Here, You might probably want to have a look at the demoes that are bundled with the install package, since they deal with all sort of subjects and show very well how easy and rich wxPython is. ! ! \subsection{ Adding a menu} ! Every application should have a menu bar and a status bar. Let's add that to ours: ! ! \begin{verbatim} ! from wxPython.wx import * ! ID_ABOUT=101 ! ID_EXIT=110 ! class MainWindow(wxFrame): ! def __init__(self,parent,id,title): ! wxFrame.__init__(self,parent,-4, title, size = ( 200,100), ! style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE) ! self.control = wxTextCtrl(self, 1, style=wxTE_MULTILINE) ! self.CreateStatusBar() # A Statusbar in the bottom of the window ! # Setting up the menu. ! filemenu= wxMenu() ! filemenu.Append(ID_ABOUT, "&About"," Information about this program") ! filemenu.AppendSeparator() ! filemenu.Append(ID_EXIT,"E&xit"," Terminate the program") ! # Creating the menubar. ! menuBar = wxMenuBar() ! menuBar.Append(filemenu,"&File") # Adding the "filemenu" to the MenuBar ! self.SetMenuBar(menuBar) # Adding the MenuBar to the Frame content. ! ! self.Show(true) ! app = wxPySimpleApp() ! frame = MainWindow(None, -1, "Sample editor") ! frame.Show(1) ! app.MainLoop() ! \end{verbatim} ! ! The only little problem is that our application does little more that showing our new menu: As it is, our menu is a deadborn deprived of any reaction. Let's implement reactions into our program: ! ! \subsection{ Practical event handling} ! Reacting to events in wxPython is called \keyword{event handling}. Flexible event handling is one of the biggest strengths of wxPython. We are going to present practical basic event handling and we'll discuss later in \emph{advanced topics}, the why and how. ! An event is a small message sent by wxPython to your application to signify that "something" has happened \footnote{the mouse has been moved, a key has been pressed, the user has popped up the menu, everything you might possibly think of...}. ! Most often, in wxPython, all you have to do, is to "connect" an event with a particular method. ! This is done by calling the pseudo methods \method{EVT_*}. By instance: ! \begin{verbatim} ! EVT_MENU(self, ID_ABOUT, self.OnAbout ) ! \end{verbatim} ! In other words, from now on, any menu selection event with ID, ID_ABOUT that is sent to window \code{self}, will be passed to the method \method{self.OnAbout}. ! The latter method has the general declaration: ! \begin{verbatim} ! def OnAbout(self, event): ! ... ! \end{verbatim} ! where event is an instance of a subclass of wxEvent. ! Let's now have a look at what it is like in our application: ! ! \begin{verbatim} ! from wxPython.wx import * ! ID_ABOUT=101 ! ID_EXIT=110 ! class MainWindow(wxFrame): ! def __init__(self,parent,id,title): ! wxFrame.__init__(self,parent,-4, title, size = ( 200,100), style=wxDEFAULT_FRAME_STYLE| ! wxNO_FULL_REPAINT_ON_RESIZE) ! self.control = wxTextCtrl(self, 1, style=wxTE_MULTILINE) ! self.CreateStatusBar() # A Statusbar in the bottom of the window ! # Setting up the menu. ! filemenu= wxMenu() ! filemenu.Append(ID_ABOUT, "&About"," Information about this program") ! filemenu.AppendSeparator() ! filemenu.Append(ID_EXIT,"E&xit"," Terminate the program") ! # Creating the menubar. ! menuBar = wxMenuBar() ! menuBar.Append(filemenu,"&File") # Adding the "filemenu" to the MenuBar ! self.SetMenuBar(menuBar) # Adding the MenuBar to the Frame content. ! EVT_MENU(self, ID_ABOUT, self.OnAbout) # attach the menu-event ID_ABOUT to the ! # method self.OnAbout ! EVT_MENU(self, ID_EXIT, self.OnExit) # attach the menu-event ID_EXIT to the ! # method self.OnExit ! self.Show(true) ! def OnAbout(self,e): ! d= wxMessageDialog( self, " A sample editor \n" ! " in wxPython","About Sample Editor", wxOK) ! # Create a message dialog box ! d.ShowModal() # Shows it ! d.Destroy() # finally destroy it when finished. ! def OnExit(self,e): ! self.Close(true) # Close the frame. ! app = wxPySimpleApp() ! frame = MainWindow(None, -1, "Sample editor") ! frame.Show(1) ! app.MainLoop() ! \end{verbatim} ! ! % ================================================================================== ! \subsection{More magic} ! Of course an editor is useless if it is not able to save or open documents. That's where Common dialogs come in. Those dialogs are those offered by the underlying platform so that your application will exactly look like a native application. ! Here is the implementation of the OnOpen method in \class{MainWindow} : ! \begin{verbatim} ! def OnOpen(self,e): ! """ Open a file""" ! dlg = wxFileDialog(self, "Choose a file", self.dirname, "", "*.*", wxOPEN) ! if dlg.ShowModal() == wxID_OK: ! self.filename=dlg.GetFilename() ! self.dirname=dlg.GetDirectory() ! f=open(self.dirname+'\\'+self.filename,'r') ! self.control.SetValue(f.read()) ! f.close() ! dlg.Destroy() ! \end{verbatim} ! This method works just in three steps: ! \begin{itemize} ! \item First, we create the dialog by calling the appropriate Constructor. ! \item Then, we call the \method{ShowModal} method, that does all the real work and returns a value corresponding to what the user has pressed ( OK button or Cancel) ! \item If necessary, we retrieve the filename and the directory of the selected file and we load it into the editor. Finally, we destroy the dialog. ! \end{itemize} ! ! Normally, you should now be able to add the corresponding entry into the menu and connect it to the \method{OnOpen} method. ! Find the complete source in appendix A. ! ! \subsection{Possible extensions} ! Of course, this program is far from being a decent editor. But adding other features should not be more difficult than what has already been done. ! You might take inspiration in the demoes that are bundled with wxPython: ! \begin{itemize} ! \item Drag and Drog. ! \item MDI ! \item Tabview/multifiles ! \item Find/Replace dialog ! \item Print dialog ! \item Macro-commands in python ( using the \function{eval} function) ! \item etc ... ! \end{itemize} ! ! % ================================================================================== ! \section{Advanced topics} ! \subsection{Events} ! Events are really one of the \emph{key feature} of wxPython. ! % TO BE CONTINUED ! \subsection{Scintilla} ! ! % TO BE CONTINUED ! \subsection{Boa-constructor} ! Boa-constructor is a RAD IDE for wxPython. ! % TO BE CONTINUED ! \subsection{multithreading} ! % Why in what way ? ! % TO BE CONTINUED ! % ================================================================================== ! \section{Useful resources} ! ! \begin{definitions} ! ! \term{\url{http://wxPython.org/} } ! To start with, a very obvious website but you can also have a look in the demo shipped in with the wxPython package. It's full of very useful examples approaching nearly all the subjects you can think of. How to run the demo: ! \begin{itemize} ! \item{under windows} Simply select the program Run The Demo in the submenu wxPython of the start menu. ! \item{under linux} find the demo directory in the source distribution and run "python demo.py" ! \end{itemize} ! ! \term{\url{http://wxwindows.org/} } ! You can also try to find directly information on the wxWindows website - Although wxPython's documentation contains all wxWindows', so it's a bit useless to go there, if you have had a look at wxPython's in the first place. ! \term{\url{http://wxpython.org/maillist.php } } ! The wxPython mailing lists. ! ! \term{\url{http://boa-constructor.sourceforge.net/} } ! Boa-constructor is a RAD GUI building IDE for wxPython. ! ! \term{\url{http://www-106.ibm.com/developerworks/library/l-wxpy/index.html} } ! An excellent article for newbies ! ! \term{\url{http://www.oreillynet.com/pub/a/Python/excerpts/chpt20/wxpython.html} } ! Last but not least: The book "Python Programming on Win32 using WxPython" of Mark Hammond and Andy Robinson has an entire (excellent) chapter on wxPython . ! ! \term{\url{http://www.scintilla.org/} } ! Scintilla is a complete editing component for which wxPython offers bindings (a control named \class{wxStyledTextCtrl2} ). ! ! \term{\url{http://www.python.org/} } ! The reference website relative to the python community. ! ! \term{\url{http://www.crosswinds.net/\~ agauld} } ! A python tutorial. ! \end{definitions} ! ! % ================================================================================== ! ! \section{As a conclusion- slithering our way to the future of GUI-apps} ! ! % ================================================================================== ! \section{contributors} ! \begin{itemize} ! \item The wxPython community ! \item Lucas Bruand ! \item Rob CakeBread ! \item Charlie Derr ! \item Robin Dunn ! \item Michael Roberts ! \end{itemize} ! ! % ================================================================================== ! ! \section{Acknowledgements} ! ! ! % ================================================================================== ! \appendix ! \section{Small editor complete source} ! \begin{verbatim} ! from wxPython.wx import * ! ID_ABOUT=101 ! ID_OPEN=102 ! ID_SAVE=103 ! ID_SAVEAS=104 ! ID_EXIT=110 ! ! class MainWindow(wxFrame): ! def __init__(self,parent,id,filename='noname.txt'): ! self.filename=filename ! self.dirname="." ! wxFrame.__init__(self,parent,-4, "Editor %s" % self.filename, size = ( 200,100), ! style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE) ! self.control = wxTextCtrl(self, 1, style=wxTE_MULTILINE) ! self.CreateStatusBar() # A Statusbar in the bottom of the window ! # Setting up the menu. ! filemenu= wxMenu() ! filemenu.Append(ID_ABOUT, "&About"," Information about this program") ! filemenu.Append(ID_OPEN,"&Open"," Open a new file ") ! filemenu.Append(ID_SAVE,"&Save"," Save the current file") ! filemenu.Append(ID_SAVEAS,"Save &As"," Save the file under a different name") ! filemenu.AppendSeparator() ! filemenu.Append(ID_EXIT,"E&xit"," Terminate the program") ! # Creating the menubar. ! menuBar = wxMenuBar() ! menuBar.Append(filemenu,"&File") # Adding the "filemenu" to the MenuBar ! self.SetMenuBar(menuBar) # Adding the MenuBar to the Frame content. ! EVT_MENU(self, ID_ABOUT, self.OnAbout) # attach the menu-event ID_ABOUT to the method self.OnAbout ! EVT_MENU(self, ID_EXIT, self.OnExit) # attach the menu-event ID_EXIT to the method self.OnExit ! EVT_MENU(self, ID_OPEN, self.OnOpen) ! EVT_MENU(self, ID_SAVE, self.OnSave) ! EVT_MENU(self, ID_SAVEAS, self.OnSaveAs) ! self.Show(true) ! \end{verbatim} ! \begin{verbatim} ! def OnAbout(self,e): ! d= wxMessageDialog( self, " A sample editor \n" ! " in wxPython","About Sample Editor", wxOK) # Create a message dialog box ! d.ShowModal() # Shows it ! d.Destroy() # finally destroy it when finished. ! def OnExit(self,e): ! self.Close(true) # Close the frame. ! def OnSave(self,e): ! """ Save the current file """ ! f=open(self.dirname+'\\'+self.filename,"w") ! f.write(self.control.GetValue()) ! f.close() ! def OnOpen(self,e): ! """ Open a file""" ! dlg = wxFileDialog(self, "Choose a file", self.dirname, "", "*.*", wxOPEN) ! if dlg.ShowModal() == wxID_OK: ! self.filename=dlg.GetFilename() ! self.dirname=dlg.GetDirectory() ! f=open(self.dirname+'\\'+self.filename,'r') ! self.control.SetValue(f.read()) ! f.close() ! dlg.Destroy() ! def OnSaveAs(self,e): ! """ Save as """ ! dlg = wxFileDialog(self, "Choose a file", self.dirname, self.filename, "*.*", wxSAVE) ! if dlg.ShowModal() == wxID_OK: ! self.filename=dlg.GetFilename() ! self.dirname=dlg.GetDirectory() ! self.OnSave(e) ! dlg.Destroy() ! \end{verbatim} ! \begin{verbatim} ! app = wxPySimpleApp() ! frame = MainWindow(None, -1) ! frame.Show(1) ! app.MainLoop() ! app.MainLoop() ! \end{verbatim} ! ! % ================================================================================== ! \end{document} --- 1,474 ---- ! % ============================================================= ! % File: wxPython-howto ! % Description: wxPython Howto main sourcefile ! % Id: $Id$ ! % Main editor: Lucas Bruand ! % ============================================================= ! ! \documentclass{howto} ! \usepackage{epsfig} ! \title{wxPython, a cross-platform GUI Library } ! \release{0.03} ! \author{The wxPython community} ! \authoraddress{\email{luc...@ec...} } ! % \makeindex ! \begin{document} ! \maketitle ! \ifhtml ! \chapter*{Front Matter\label{front}} ! \fi ! ! % ============================================================= ! % Inclusion of the Abstract ! % ============================================================= ! % File: abstract.tex ! % Description: Abstract of the wxPython-howto ! % Id: $Id$ ! % Main editor: Lucas Bruand ! % ============================================================= ! ! \begin{abstract} ! \noindent ! In this document, we present a cross-platform GUI\index{GUI} ( Graphical User Interface) called wxPython\index{wxPython}. We shall be using wxPython 2.2.5 . We shall also introduce a few advanced topics that make the strength of wxPython. ! ! This document is available in several formats, including PostScript, ! PDF, HTML and plain ASCII, from the Python HOWTO page at ! \url{http://py-howto.sourceforge.net/}. ! ! \end{abstract} ! % Creation of the table of content ! \tableofcontents ! ! % Inclusion of the introduction ! % ============================================================= ! % File: introduction.tex ! % Description: Introduction of the wxPython-howto ! % Id: $Id$ ! % Main editor: Lucas Bruand ! % ============================================================= ! \section{What is wxPython ? } ! WxPython ranks amongst the toolkits that enable writing cross-platform GUI-applications like \module{pyQT}\refexmodindex{pyQT}, \module{pyGTK}\refexmodindex{pyGTK}, or \module{Tkinter}\refexmodindex{Tkinter}. But under windows, and unlike \module{Tkinter} or \module{pyGTK}, a \module{wxPython} Application has a look and feel very similar to what you would get with an application using microsoft native GUI, MFC \footnote{Microsoft Foundation Classes}. This is because wxPython is a fine layer over the native GUI classes. Besides this, wxPython is very simple to learn and takes advantage of the possibilities Python is offering. By instance, events handling is particularly nice under wxPython. ! In fact, wxPython is simply (?) Python Bindings to a C++ Library called wxWindows; dating back from 1992 \footnote{It's almost as old as Tkinter - which dates back from 1990}, wxWindows is now a very stable, efficient, object-oriented library running (smoothly) on Windows, Unix ( GTK/Motif/Lesstif) and soon Macintosh. ! % Inclusion of the prerequisites ! % ============================================================= ! % File: prerequisites.tex ! % Description: Prerequisites section of the wxPython-howto ! % Id: $Id$ ! % Main editor: Lucas Bruand ! % ============================================================= ! \section{Prerequisites} ! We assume the reader has sufficient knowledge of Python and is familiar with classes and objects in Python\footnote{ If you are not already a Pythonista,you might want to have a look at \url{http://www.crosswinds.net/\~{}agauld } }. No other knowledge is required. ! % Inclusion of the installation part ! % ============================================================= ! % File: installation.tex ! % Description: installation part of the wxPython-howto ! % Id: $Id$ ! % Main editor: Lucas Bruand ! % ============================================================= ! \section{Installation} ! ! \subsection{Windows} ! Installation under windows is especially simple: Run the installer you can get from \url{http://www.wxpython.org/download.php} and follow the instructions. ! ! \subsection{Linux - Redhat} ! You can find RPMs for Redhat (they are working just fine with Mandrake though), at the address \url{http://www.wxpython.org/download.php}. ! ! \subsection{Linux - Building from the source} ! TO DO ! % TO BE CONTINUED. ! % Inclusion of the hello world part ! % ============================================================= ! % File: helloworld.tex ! % Description: hello world application building part of the wxPython-howto ! % Id: $Id$ ! % Main editor: Lucas Bruand ! % ============================================================= ! ! \section{A first application - Hello, world} ! As is traditional, we are first going to write a Small "Hello, world" application. ! Here is the code: ! \begin{verbatim} ! from wxPython.wx import wxPySimpleApp, wxFrame ! app = wxPySimpleApp() ! frame = wxFrame(None, -1, "Hello World") ! frame.Show(1) ! app.MainLoop() ! \end{verbatim} ! \ifhtml ! \begin{figure} ! \epsfig{file=helloworld.eps} ! %\includegraphics[height=2.in]{helloworld.eps} ! \caption{Hello, World application} ! \end{figure} ! \fi ! ! After importing \module{wxPython} GUI, we instantiate a new \class{wxPySimpleApp} and a new \class{wxFrame}. A frame in wxPython is a window with its titlebar, reduction and close buttons, etc... \footnote{it can be a normal application window, a MDI parent frame, etc...} We make this \keyword{Frame} appear by "showing" it. Eventually, we start the application's \method{MainLoop} whose role ! ! % Inclusion of the Small Editor part ! % ============================================================= ! % File: smalleditor.tex ! % Description: Small editor application building part of the wxPython-howto ! % Id: $Id$ ! % Main editor: Lucas Bruand ! % ============================================================= ! ! \section{Pushing it a bit further - Marvels of wxPython} ! In this section, we shall build a little editor. This is mostly to convince you of the inner capabilities and of the simplicity of use of wxPython. If you are already convinced you might as well want to read first \emph{Advanced Topics}. ! ! % ================================================================================== ! \subsection{Adding the edit component} ! The first step is to add a new edit component. The code herein appears, by courtesy of Mr Michael Roberts\footnote{ See Also his excellent article in Useful resources }. ! ! \begin{verbatim} ! from wxPython.wx import * ! class MainWindow(wxFrame): ! """ We simply derive a new class of Frame. """ ! def __init__(self,parent,id,title): ! wxFrame.__init__(self,parent,-4, title, size = ( 200,100), ! style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE) ! self.control = wxTextCtrl(self, 1, style=wxTE_MULTILINE) ! self.Show(true) ! app = wxPySimpleApp() ! frame = MainWindow(None, -1, "Small editor") ! frame.Show(1) ! app.MainLoop() ! \end{verbatim} ! ! \ifhtml ! \begin{figure} ! \epsfig{file=editapp1.eps} ! % \includegraphics[height=2.in]{editapp1.eps} ! \caption{Small Editor application} ! \end{figure} ! \fi ! ! As you can see, it is not very difficult: All we have to do is to derive \class{wxFrame} and then overload its \method{__init__} method. In this method, we declare a new \class{wxTextCtrl}, which is a simple text edit control. Here, You might probably want to have a look at the demoes that are bundled with the install package, since they deal with all sort of subjects and show very well how easy and rich wxPython is. ! % ================================================================================== ! \subsection{ Adding a menu} ! Every application should have a menu bar and a status bar. Let's add that to ours: ! ! \begin{verbatim} ! from wxPython.wx import * ! ID_ABOUT=101 ! ID_EXIT=110 ! class MainWindow(wxFrame): ! def __init__(self,parent,id,title): ! wxFrame.__init__(self,parent,-4, title, size = ( 200,100), ! style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE) ! self.control = wxTextCtrl(self, 1, style=wxTE_MULTILINE) ! self.CreateStatusBar() # A Statusbar in the bottom of the window ! # Setting up the menu. ! filemenu= wxMenu() ! filemenu.Append(ID_ABOUT, "&About"," Information about this program") ! filemenu.AppendSeparator() ! filemenu.Append(ID_EXIT,"E&xit"," Terminate the program") ! # Creating the menubar. ! menuBar = wxMenuBar() ! menuBar.Append(filemenu,"&File") # Adding the "filemenu" to the MenuBar ! self.SetMenuBar(menuBar) # Adding the MenuBar to the Frame content. ! ! self.Show(true) ! app = wxPySimpleApp() ! frame = MainWindow(None, -1, "Sample editor") ! frame.Show(1) ! app.MainLoop() ! \end{verbatim} ! \ifhtml ! \begin{figure} ! \epsfig{file=editapp2.eps} ! % \includegraphics[height=2.in]{editapp2.eps} ! \caption{Small Editor application with menu bar} ! \end{figure} ! \fi ! The only little problem is that our application does little more that showing our new menu: As it is, our menu is a deadborn deprived of any reaction. Let's implement reactions into our program: ! ! % ================================================================================== ! \subsection{ Practical event handling} ! Reacting to events in wxPython is called \keyword{event handling}. Flexible event handling is one of the biggest strengths of wxPython. We are going to present practical basic event handling and we'll discuss later in \emph{advanced topics}, the why and how. ! An event is a small message sent by wxPython to your application to signify that "something" has happened \footnote{the mouse has been moved, a key has been pressed, the user has popped up the menu, everything you might possibly think of...}. ! Most often, in wxPython, all you have to do, is to "connect" an event with a particular method. ! This is done by calling the pseudo methods \method{EVT_*}. By instance: ! \begin{verbatim} ! EVT_MENU(self, ID_ABOUT, self.OnAbout ) ! \end{verbatim} ! In other words, from now on, any menu selection event with ID, ID_ABOUT that is sent to window \code{self}, will be passed to the method \method{self.OnAbout}. ! The latter method has the general declaration: ! \begin{verbatim} ! def OnAbout(self, event): ! ... ! \end{verbatim} ! where event is an instance of a subclass of wxEvent. ! Let's now have a look at what it is like in our application: ! ! \begin{verbatim} ! from wxPython.wx import * ! ID_ABOUT=101 ! ID_EXIT=110 ! class MainWindow(wxFrame): ! def __init__(self,parent,id,title): ! wxFrame.__init__(self,parent,-4, title, size = ( 200,100), ! style=wxDEFAULT_FRAME_STYLE| ! wxNO_FULL_REPAINT_ON_RESIZE) ! self.control = wxTextCtrl(self, 1, style=wxTE_MULTILINE) ! self.CreateStatusBar() # A Statusbar in the bottom of the window ! # Setting up the menu. ! filemenu= wxMenu() ! filemenu.Append(ID_ABOUT, "&About"," Information about this program") ! filemenu.AppendSeparator() ! filemenu.Append(ID_EXIT,"E&xit"," Terminate the program") ! # Creating the menubar. ! menuBar = wxMenuBar() ! menuBar.Append(filemenu,"&File") # Adding the "filemenu" to the MenuBar ! self.SetMenuBar(menuBar) # Adding the MenuBar to the Frame content. ! EVT_MENU(self, ID_ABOUT, self.OnAbout) # attach the menu-event ID_ABOUT to the ! # method self.OnAbout ! EVT_MENU(self, ID_EXIT, self.OnExit) # attach the menu-event ID_EXIT to the ! # method self.OnExit ! self.Show(true) ! def OnAbout(self,e): ! d= wxMessageDialog( self, " A sample editor \n" ! " in wxPython","About Sample Editor", wxOK) ! # Create a message dialog box ! d.ShowModal() # Shows it ! d.Destroy() # finally destroy it when finished. ! def OnExit(self,e): ! self.Close(true) # Close the frame. ! app = wxPySimpleApp() ! frame = MainWindow(None, -1, "Sample editor") ! frame.Show(1) ! app.MainLoop() ! \end{verbatim} ! ! % ================================================================================== ! \subsection{More magic} ! Of course an editor is useless if it is not able to save or open documents. That's where Common dialogs come in. Those dialogs are those offered by the underlying platform so that your application will exactly look like a native application. ! Here is the implementation of the OnOpen method in \class{MainWindow} : ! \begin{verbatim} ! def OnOpen(self,e): ! """ Open a file""" ! dlg = wxFileDialog(self, "Choose a file", self.dirname, "", "*.*", wxOPEN) ! if dlg.ShowModal() == wxID_OK: ! self.filename=dlg.GetFilename() ! self.dirname=dlg.GetDirectory() ! f=open(self.dirname+'\\'+self.filename,'r') ! self.control.SetValue(f.read()) ! f.close() ! dlg.Destroy() ! \end{verbatim} ! This method works just in three steps: ! \begin{itemize} ! \item First, we create the dialog by calling the appropriate Constructor. ! \item Then, we call the \method{ShowModal} method, that does all the real work and returns a value corresponding to what the user has pressed ( OK button or Cancel) ! \item If necessary, we retrieve the filename and the directory of the selected file and we load it into the editor. Finally, we destroy the dialog. ! \end{itemize} ! ! Normally, you should now be able to add the corresponding entry into the menu and connect it to the \method{OnOpen} method. ! Find the complete source in appendix A. ! \ifhtml ! And have a look at the result: ! \begin{figure} ! % \epsfig{editapp3.eps, height=1.in} ! % \includegraphics[height=1.in]{editapp3.eps} ! ! \caption{Small editor application with Common dialogs} ! \end{figure} ! \fi ! % ================================================================================== ! \subsection{Possible extensions} ! Of course, this program is far from being a decent editor. But adding other features should not be more difficult than what has already been done. ! You might take inspiration in the demoes that are bundled with wxPython: ! \begin{itemize} ! \item Drag and Drog. ! \item MDI ! \item Tabview/multifiles ! \item Find/Replace dialog ! \item Print dialog ! \item Macro-commands in python ( using the \function{eval} function) ! \item etc ... ! \end{itemize} ! ! % Inclusion of the Forms part ! % ============================================================= ! % File: forms.tex ! % Description: forms presentation part of the wxPython-howto ! % Id: $Id$ ! % Main editor: Lucas Bruand ! % ============================================================= ! \section{Building forms} ! ! % Inclusion of the Advanced topics ! % ============================================================= ! % File: avdtopics.tex ! % Description: Advanced topics part of the wxPython-howto ! % Id: $Id$ ! % Main editor: Lucas Bruand ! % ============================================================= ! ! \section{Advanced topics} ! \subsection{Events} ! Events are really one of the \emph{key feature} of wxPython. ! % TO BE CONTINUED ! \subsection{Scintilla} ! ! % TO BE CONTINUED ! \subsection{Boa-constructor} ! Boa-constructor is a RAD IDE for wxPython. ! % TO BE CONTINUED ! \subsection{multithreading} ! % Why in what way ? ! % TO BE CONTINUED ! % Inclusion of the Useful resources ! % ============================================================= ! % File: resources.tex ! % Description: Useful resources part of the wxPython-howto ! % Id: $Id$ ! % Main editor: Lucas Bruand ! % ============================================================= ! ! \section{Useful resources} ! ! \begin{definitions} ! ! \term{\url{http://wxPython.org/} } ! To start with, a very obvious website but you can also have a look in the demo shipped in with the wxPython package. It's full of very useful examples approaching nearly all the subjects you can think of. How to run the demo: ! \begin{itemize} ! \item{under windows} Simply select the program Run The Demo in the submenu wxPython of the start menu. ! \item{under linux} find the demo directory in the source distribution and run "python demo.py" ! \end{itemize} ! ! \term{\url{http://wxwindows.org/} } ! You can also try to find directly information on the wxWindows website - Although wxPython's documentation contains all wxWindows', so it's a bit useless to go there, if you have had a look at wxPython's in the first place. ! \term{\url{http://wxpython.org/maillist.php } } ! The wxPython mailing lists. ! ! \term{\url{http://boa-constructor.sourceforge.net/} } ! Boa-constructor is a RAD GUI building IDE for wxPython. ! ! \term{\url{http://www-106.ibm.com/developerworks/library/l-wxpy/index.html} } ! An excellent article for newbies ! ! \term{\url{http://www.oreillynet.com/pub/a/Python/excerpts/chpt20/wxpython.html} } ! Last but not least: The book "Python Programming on Win32 using WxPython" of Mark Hammond and Andy Robinson has an entire (excellent) chapter on wxPython . ! ! \term{\url{http://www.scintilla.org/} } ! Scintilla is a complete editing component for which wxPython offers bindings (a control named \class{wxStyledTextCtrl2} ). ! ! \term{\url{http://www.python.org/} } ! The reference website relative to the python community. ! ! \term{\url{http://www.crosswinds.net/\symbol{"7e}agauld} } ! A python tutorial. ! \end{definitions} ! ! % Inclusion of the Conclusion ! % ============================================================= ! % File: conclusion.tex ! % Description: conclusion of the wxPython-howto ! % Id: $Id$ ! % Main editor: Lucas Bruand ! % ============================================================= ! \section{As a conclusion- slithering our way to the future of GUI-apps} ! % Inclusion of the Contributors ! % ============================================================= ! % File: contributors.tex ! % Description: contributors of the wxPython-howto ! % Id: $Id$ ! % Main editor: Lucas Bruand ! % ============================================================= ! ! \section{contributors} ! \begin{itemize} ! \item The wxPython community ! \item Lucas Bruand ! \item Rob CakeBread ! \item Charlie Derr ! \item Robin Dunn ! \item Michael Roberts ! \end{itemize} ! % Inclusion of the Appendix ! % ============================================================= ! % File: appendix.tex ! % Description: appendix of the wxPython-howto ! % Id: $Id$ ! % Main editor: Lucas Bruand ! % ============================================================= ! ! \appendix ! \section{Small editor complete source} ! \begin{verbatim} ! from wxPython.wx import * ! ID_ABOUT=101 ! ID_OPEN=102 ! ID_SAVE=103 ! ID_SAVEAS=104 ! ID_EXIT=110 ! ! class MainWindow(wxFrame): ! def __init__(self,parent,id,filename='noname.txt'): ! self.filename=filename ! self.dirname="." ! wxFrame.__init__(self,parent,-4, "Editor %s" % self.filename, size = ( 200,100), ! style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE) ! self.control = wxTextCtrl(self, 1, style=wxTE_MULTILINE) ! self.CreateStatusBar() # A Statusbar in the bottom of the window ! # Setting up the menu. ! filemenu= wxMenu() ! filemenu.Append(ID_ABOUT, "&About"," Information about this program") ! filemenu.Append(ID_OPEN,"&Open"," Open a new file ") ! filemenu.Append(ID_SAVE,"&Save"," Save the current file") ! filemenu.Append(ID_SAVEAS,"Save &As"," Save the file under a different name") ! filemenu.AppendSeparator() ! filemenu.Append(ID_EXIT,"E&xit"," Terminate the program") ! # Creating the menubar. ! menuBar = wxMenuBar() ! menuBar.Append(filemenu,"&File") # Adding the "filemenu" to the MenuBar ! self.SetMenuBar(menuBar) # Adding the MenuBar to the Frame content. ! EVT_MENU(self, ID_ABOUT, self.OnAbout) # attach the menu-event ID_ABOUT to the method self.OnAbout ! EVT_MENU(self, ID_EXIT, self.OnExit) # attach the menu-event ID_EXIT to the method self.OnExit ! EVT_MENU(self, ID_OPEN, self.OnOpen) ! EVT_MENU(self, ID_SAVE, self.OnSave) ! EVT_MENU(self, ID_SAVEAS, self.OnSaveAs) ! self.Show(true) ! \end{verbatim} ! \begin{verbatim} ! def OnAbout(self,e): ! d= wxMessageDialog( self, " A sample editor \n" ! " in wxPython","About Sample Editor", wxOK) # Create a message dialog box ! d.ShowModal() # Shows it ! d.Destroy() # finally destroy it when finished. ! def OnExit(self,e): ! self.Close(true) # Close the frame. ! def OnSave(self,e): ! """ Save the current file """ ! f=open(self.dirname+'\\'+self.filename,"w") ! f.write(self.control.GetValue()) ! f.close() ! def OnOpen(self,e): ! """ Open a file""" ! dlg = wxFileDialog(self, "Choose a file", self.dirname, "", "*.*", wxOPEN) ! if dlg.ShowModal() == wxID_OK: ! self.filename=dlg.GetFilename() ! self.dirname=dlg.GetDirectory() ! f=open(self.dirname+'\\'+self.filename,'r') ! self.control.SetValue(f.read()) ! f.close() ! dlg.Destroy() ! def OnSaveAs(self,e): ! """ Save as """ ! dlg = wxFileDialog(self, "Choose a file", self.dirname, self.filename, "*.*", wxSAVE) ! if dlg.ShowModal() == wxID_OK: ! self.filename=dlg.GetFilename() ! self.dirname=dlg.GetDirectory() ! self.OnSave(e) ! dlg.Destroy() ! \end{verbatim} ! \begin{verbatim} ! app = wxPySimpleApp() ! frame = MainWindow(None, -1) ! frame.Show(1) ! app.MainLoop() ! app.MainLoop() ! \end{verbatim} ! % ================================================================================== ! ! \end{document} \ No newline at end of file |
From: A.M. K. <aku...@us...> - 2001-03-28 18:57:48
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv23717 Added Files: wxpython.tex Log Message: First draft of wxPython HOWTO from Lucas Bruand --- NEW FILE --- % ================================================================================== % % HOWTO : wxPython, a cross-platform GUI Library % $ Id $ % ================================================================================== \documentclass{howto} \usepackage{epsfig} \input epsf \title{wxPython, a cross-platform GUI Library } \release{0.03} \author{The wxPython community} \authoraddress{\email{luc...@ec...} } \begin{document} \maketitle \ifhtml \chapter*{Front Matter\label{front}} \fi % ================================================================================== \begin{abstract} \noindent In this document, we present a cross-platform GUI ( Graphical User Interface) called wxPython. We shall be using wxPython 2.2.5 . We shall also introduce a few advanced topics that make the strength of wxPython. This document is available in several formats, including PostScript, PDF, HTML and plain ASCII, from the Python HOWTO page at \url{http://py-howto.sourceforge.net/}. \end{abstract} % ================================================================================== \tableofcontents % ================================================================================== \section{What is wxPython ? } WxPython ranks amongst the toolkits that enable writing cross-platform GUI-applications like \module{pyQT}, \module{pyGTK}, or \module{Tkinter}. But under windows, and unlike \module{Tkinter} or \module{pyGTK}, a \module{wxPython} Application has a look and feel very similar to what you would get with an application using microsoft native GUI, MFC \footnote{Microsoft Foundation Classes}. This is because wxPython is a fine layer over the native GUI classes. Besides this, wxPython is very simple to learn and takes advantage of the possibilities Python is offering. By instance, events handling is particularly nice under wxPython. In fact, wxPython is simply (?) Python Bindings to a C++ Library called wxWindows; dating back from 1992 \footnote{It's almost as old as Tkinter - which dates back from 1990}, wxWindows is now a very stable, efficient, object-oriented library running (smoothly) on Windows, Unix ( GTK/Motif/Lesstif) and soon Macintosh. % ================================================================================== \section{Prerequisites} We assume the reader has sufficient knowledge of Python and is familiar with classes and objects in Python\footnote{ If you are not already a Pythonista,you might want to have a look at \url{http://www.crosswinds.net/~agauld } }. No other knowledge is required. % ================================================================================== \section{Installation} \subsection{Windows} Installation under windows is especially simple: Run the installer you can get from \url{http://www.wxpython.org/download.php} and follow the instructions. \subsection{Linux - Redhat} You can find RPMs for Redhat (they are working just fine with Mandrake though), at the address \url{http://www.wxpython.org/download.php}. \subsection{Linux - Building from the source} TO DO % TO BE CONTINUED. % ================================================================================== \section{A first application - Hello, world} As is traditional, we are first going to write a Small "Hello, world" application. Here is the code: % Old code: % from wxPython.wx import * % class HelloApp(wxApp): % def OnInit(self): % frame = wxFrame(None,-1,"Hello, world") % frame.Show(true) % self.SetTopWindow(frame) % return true % app = HelloApp() % app.MainLoop() % New code: \begin{verbatim} from wxPython.wx import wxPySimpleApp, wxFrame app = wxPySimpleApp() frame = wxFrame(None, -1, "Hello World") frame.Show(1) app.MainLoop() \end{verbatim} \begin{figure} \epsfig{file=helloworld.eps} \caption{Hello, World application} \end{figure} % After importing \module{wxPython} GUI, we derive our new application from wxPython's original application abstract class. This lets use rewrite the \method{OnInit} method. % This is where the real work is: % We instantiate a new \keyword{Frame}\footnote{A frame in wxPython is a window with its titlebar, reduction and close buttons, etc... it can be a normal application window, a MDI parent frame, etc...} with the constructor \class{wxFrame}. We make this \keyword{Frame} appear by "showing" it. Eventually, we tell the application that this frame is going to be its Topwindow ( so that the application terminates when you close the frame). % Explaination: After importing \module{wxPython} GUI, we instantiate a new \class{wxPySimpleApp} and a new \class{wxFrame}. A frame in wxPython is a window with its titlebar, reduction and close buttons, etc... \footnote{it can be a normal application window, a MDI parent frame, etc...} We make this \keyword{Frame} appear by "showing" it. Eventually, we start the application's \method{MainLoop} whose role % ================================================================================== \section{Pushing it a bit further - Marvels of wxPython} In this section, we shall build a little editor. This is mostly to convince you of the inner capabilities and of the simplicity of use of wxPython. If you are already convinced you might as well want to read first \emph{Advanced Topics}. \subsection{Adding the edit component} The first step is to add a new edit component. The code herein appears, by courtesy of Mr Michael Roberts\footnote{ See Also his excellent article in Useful resources }. \begin{verbatim} from wxPython.wx import * class MainWindow(wxFrame): """ We simply derive a new class of Frame. """ def __init__(self,parent,id,title): wxFrame.__init__(self,parent,-4, title, size = ( 200,100), style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE) self.control = wxTextCtrl(self, 1, style=wxTE_MULTILINE) self.Show(true) app = wxPySimpleApp() frame = MainWindow(None, -1, "Sample editor") frame.Show(1) app.MainLoop() \end{verbatim} %class EditApp(wxApp): % def OnInit(self): % frame = MainWindow(None,-1,"A sample edit ctrl") % frame.Show(true) % self.SetTopWindow(frame) % return true %app = EditApp() %app.MainLoop() As you can see, it is not very difficult: All we have to do is to derive \class{wxFrame} and then overload its \method{__init__} method. In this method, we declare a new \class{wxTextCtrl}, which is a simple text edit control. Here, You might probably want to have a look at the demoes that are bundled with the install package, since they deal with all sort of subjects and show very well how easy and rich wxPython is. \subsection{ Adding a menu} Every application should have a menu bar and a status bar. Let's add that to ours: \begin{verbatim} from wxPython.wx import * ID_ABOUT=101 ID_EXIT=110 class MainWindow(wxFrame): def __init__(self,parent,id,title): wxFrame.__init__(self,parent,-4, title, size = ( 200,100), style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE) self.control = wxTextCtrl(self, 1, style=wxTE_MULTILINE) self.CreateStatusBar() # A Statusbar in the bottom of the window # Setting up the menu. filemenu= wxMenu() filemenu.Append(ID_ABOUT, "&About"," Information about this program") filemenu.AppendSeparator() filemenu.Append(ID_EXIT,"E&xit"," Terminate the program") # Creating the menubar. menuBar = wxMenuBar() menuBar.Append(filemenu,"&File") # Adding the "filemenu" to the MenuBar self.SetMenuBar(menuBar) # Adding the MenuBar to the Frame content. self.Show(true) app = wxPySimpleApp() frame = MainWindow(None, -1, "Sample editor") frame.Show(1) app.MainLoop() \end{verbatim} The only little problem is that our application does little more that showing our new menu: As it is, our menu is a deadborn deprived of any reaction. Let's implement reactions into our program: \subsection{ Practical event handling} Reacting to events in wxPython is called \keyword{event handling}. Flexible event handling is one of the biggest strengths of wxPython. We are going to present practical basic event handling and we'll discuss later in \emph{advanced topics}, the why and how. An event is a small message sent by wxPython to your application to signify that "something" has happened \footnote{the mouse has been moved, a key has been pressed, the user has popped up the menu, everything you might possibly think of...}. Most often, in wxPython, all you have to do, is to "connect" an event with a particular method. This is done by calling the pseudo methods \method{EVT_*}. By instance: \begin{verbatim} EVT_MENU(self, ID_ABOUT, self.OnAbout ) \end{verbatim} In other words, from now on, any menu selection event with ID, ID_ABOUT that is sent to window \code{self}, will be passed to the method \method{self.OnAbout}. The latter method has the general declaration: \begin{verbatim} def OnAbout(self, event): ... \end{verbatim} where event is an instance of a subclass of wxEvent. Let's now have a look at what it is like in our application: \begin{verbatim} from wxPython.wx import * ID_ABOUT=101 ID_EXIT=110 class MainWindow(wxFrame): def __init__(self,parent,id,title): wxFrame.__init__(self,parent,-4, title, size = ( 200,100), style=wxDEFAULT_FRAME_STYLE| wxNO_FULL_REPAINT_ON_RESIZE) self.control = wxTextCtrl(self, 1, style=wxTE_MULTILINE) self.CreateStatusBar() # A Statusbar in the bottom of the window # Setting up the menu. filemenu= wxMenu() filemenu.Append(ID_ABOUT, "&About"," Information about this program") filemenu.AppendSeparator() filemenu.Append(ID_EXIT,"E&xit"," Terminate the program") # Creating the menubar. menuBar = wxMenuBar() menuBar.Append(filemenu,"&File") # Adding the "filemenu" to the MenuBar self.SetMenuBar(menuBar) # Adding the MenuBar to the Frame content. EVT_MENU(self, ID_ABOUT, self.OnAbout) # attach the menu-event ID_ABOUT to the # method self.OnAbout EVT_MENU(self, ID_EXIT, self.OnExit) # attach the menu-event ID_EXIT to the # method self.OnExit self.Show(true) def OnAbout(self,e): d= wxMessageDialog( self, " A sample editor \n" " in wxPython","About Sample Editor", wxOK) # Create a message dialog box d.ShowModal() # Shows it d.Destroy() # finally destroy it when finished. def OnExit(self,e): self.Close(true) # Close the frame. app = wxPySimpleApp() frame = MainWindow(None, -1, "Sample editor") frame.Show(1) app.MainLoop() \end{verbatim} % ================================================================================== \subsection{More magic} Of course an editor is useless if it is not able to save or open documents. That's where Common dialogs come in. Those dialogs are those offered by the underlying platform so that your application will exactly look like a native application. Here is the implementation of the OnOpen method in \class{MainWindow} : \begin{verbatim} def OnOpen(self,e): """ Open a file""" dlg = wxFileDialog(self, "Choose a file", self.dirname, "", "*.*", wxOPEN) if dlg.ShowModal() == wxID_OK: self.filename=dlg.GetFilename() self.dirname=dlg.GetDirectory() f=open(self.dirname+'\\'+self.filename,'r') self.control.SetValue(f.read()) f.close() dlg.Destroy() \end{verbatim} This method works just in three steps: \begin{itemize} \item First, we create the dialog by calling the appropriate Constructor. \item Then, we call the \method{ShowModal} method, that does all the real work and returns a value corresponding to what the user has pressed ( OK button or Cancel) \item If necessary, we retrieve the filename and the directory of the selected file and we load it into the editor. Finally, we destroy the dialog. \end{itemize} Normally, you should now be able to add the corresponding entry into the menu and connect it to the \method{OnOpen} method. Find the complete source in appendix A. \subsection{Possible extensions} Of course, this program is far from being a decent editor. But adding other features should not be more difficult than what has already been done. You might take inspiration in the demoes that are bundled with wxPython: \begin{itemize} \item Drag and Drog. \item MDI \item Tabview/multifiles \item Find/Replace dialog \item Print dialog \item Macro-commands in python ( using the \function{eval} function) \item etc ... \end{itemize} % ================================================================================== \section{Advanced topics} \subsection{Events} Events are really one of the \emph{key feature} of wxPython. % TO BE CONTINUED \subsection{Scintilla} % TO BE CONTINUED \subsection{Boa-constructor} Boa-constructor is a RAD IDE for wxPython. % TO BE CONTINUED \subsection{multithreading} % Why in what way ? % TO BE CONTINUED % ================================================================================== \section{Useful resources} \begin{definitions} \term{\url{http://wxPython.org/} } To start with, a very obvious website but you can also have a look in the demo shipped in with the wxPython package. It's full of very useful examples approaching nearly all the subjects you can think of. How to run the demo: \begin{itemize} \item{under windows} Simply select the program Run The Demo in the submenu wxPython of the start menu. \item{under linux} find the demo directory in the source distribution and run "python demo.py" \end{itemize} \term{\url{http://wxwindows.org/} } You can also try to find directly information on the wxWindows website - Although wxPython's documentation contains all wxWindows', so it's a bit useless to go there, if you have had a look at wxPython's in the first place. \term{\url{http://wxpython.org/maillist.php } } The wxPython mailing lists. \term{\url{http://boa-constructor.sourceforge.net/} } Boa-constructor is a RAD GUI building IDE for wxPython. \term{\url{http://www-106.ibm.com/developerworks/library/l-wxpy/index.html} } An excellent article for newbies \term{\url{http://www.oreillynet.com/pub/a/Python/excerpts/chpt20/wxpython.html} } Last but not least: The book "Python Programming on Win32 using WxPython" of Mark Hammond and Andy Robinson has an entire (excellent) chapter on wxPython . \term{\url{http://www.scintilla.org/} } Scintilla is a complete editing component for which wxPython offers bindings (a control named \class{wxStyledTextCtrl2} ). \term{\url{http://www.python.org/} } The reference website relative to the python community. \term{\url{http://www.crosswinds.net/\~ agauld} } A python tutorial. \end{definitions} % ================================================================================== \section{As a conclusion- slithering our way to the future of GUI-apps} % ================================================================================== \section{contributors} \begin{itemize} \item The wxPython community \item Lucas Bruand \item Rob CakeBread \item Charlie Derr \item Robin Dunn \item Michael Roberts \end{itemize} % ================================================================================== \section{Acknowledgements} % ================================================================================== \appendix \section{Small editor complete source} \begin{verbatim} from wxPython.wx import * ID_ABOUT=101 ID_OPEN=102 ID_SAVE=103 ID_SAVEAS=104 ID_EXIT=110 class MainWindow(wxFrame): def __init__(self,parent,id,filename='noname.txt'): self.filename=filename self.dirname="." wxFrame.__init__(self,parent,-4, "Editor %s" % self.filename, size = ( 200,100), style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE) self.control = wxTextCtrl(self, 1, style=wxTE_MULTILINE) self.CreateStatusBar() # A Statusbar in the bottom of the window # Setting up the menu. filemenu= wxMenu() filemenu.Append(ID_ABOUT, "&About"," Information about this program") filemenu.Append(ID_OPEN,"&Open"," Open a new file ") filemenu.Append(ID_SAVE,"&Save"," Save the current file") filemenu.Append(ID_SAVEAS,"Save &As"," Save the file under a different name") filemenu.AppendSeparator() filemenu.Append(ID_EXIT,"E&xit"," Terminate the program") # Creating the menubar. menuBar = wxMenuBar() menuBar.Append(filemenu,"&File") # Adding the "filemenu" to the MenuBar self.SetMenuBar(menuBar) # Adding the MenuBar to the Frame content. EVT_MENU(self, ID_ABOUT, self.OnAbout) # attach the menu-event ID_ABOUT to the method self.OnAbout EVT_MENU(self, ID_EXIT, self.OnExit) # attach the menu-event ID_EXIT to the method self.OnExit EVT_MENU(self, ID_OPEN, self.OnOpen) EVT_MENU(self, ID_SAVE, self.OnSave) EVT_MENU(self, ID_SAVEAS, self.OnSaveAs) self.Show(true) \end{verbatim} \begin{verbatim} def OnAbout(self,e): d= wxMessageDialog( self, " A sample editor \n" " in wxPython","About Sample Editor", wxOK) # Create a message dialog box d.ShowModal() # Shows it d.Destroy() # finally destroy it when finished. def OnExit(self,e): self.Close(true) # Close the frame. def OnSave(self,e): """ Save the current file """ f=open(self.dirname+'\\'+self.filename,"w") f.write(self.control.GetValue()) f.close() def OnOpen(self,e): """ Open a file""" dlg = wxFileDialog(self, "Choose a file", self.dirname, "", "*.*", wxOPEN) if dlg.ShowModal() == wxID_OK: self.filename=dlg.GetFilename() self.dirname=dlg.GetDirectory() f=open(self.dirname+'\\'+self.filename,'r') self.control.SetValue(f.read()) f.close() dlg.Destroy() def OnSaveAs(self,e): """ Save as """ dlg = wxFileDialog(self, "Choose a file", self.dirname, self.filename, "*.*", wxSAVE) if dlg.ShowModal() == wxID_OK: self.filename=dlg.GetFilename() self.dirname=dlg.GetDirectory() self.OnSave(e) dlg.Destroy() \end{verbatim} \begin{verbatim} app = wxPySimpleApp() frame = MainWindow(None, -1) frame.Show(1) app.MainLoop() app.MainLoop() \end{verbatim} % ================================================================================== \end{document} |
From: A.M. K. <aku...@us...> - 2001-03-27 22:04:09
|
Update of /cvsroot/py-howto/pyhowto/topic In directory usw-pr-cvs1:/tmp/cvs-serv7900 Added Files: README Log Message: Add readme file --- NEW FILE --- This directory contains the Python topic guides. The plan is to maintain the original topic guide in XML format, and write a script to process the XML and produce HTML output. (The script hasn't been written yet.) database.xml Database scicomp.xml Scientific computing tkinter.xml Tkinter |
From: A.M. K. <aku...@us...> - 2001-03-27 21:50:18
|
Update of /cvsroot/py-howto/pyhowto/topic In directory usw-pr-cvs1:/tmp/cvs-serv4888 Added Files: database.xml Log Message: XML master file for the database topic guide --- NEW FILE --- <?xml version="1.0" encoding="iso-8859-1"?> <topic-guide> <section id="modules"> <title>Database Modules</title> <description>The database modules listed on this page have been written to conform to the DB-SIG's proposed API. </description> <link href="ftp://people.linuxkorea.co.kr/pub/DB2/"> <title>DB/2</title> <description>An interface to IBM DB2. Maintained by Man-Yong (Bryan) Lee. </description> </link> <link href="http://www.chordate.com/gadfly.html"> <title>Gadfly</title> <description>Gadfly is a simple relational database system implemented in Python based on the SQL Structured Query Language, and includes a DB-API compliant interface. Maintained by Aaron Watters. </description> </link> <link href="http://starship.python.net/crew/sturner/informixdb.html"> <title>Informix</title> <description>Currently maintained by Stephen J. Turner. </description> </link> <link href="http://thor.prohosting.com/~alexan/pub/Kinfxdb/Kinfxdb-0.2.tar.gz"> <title>Informix (Kinfxdb)</title> <description>A completely new informix module, called Kinfxdb. Maintained by Alexander Kuznetsov.</description> </link> <link href="http://kinterbasdb.sourceforge.net"> <title>Interbase (Kinterbasdb)</title> <description>An interface for Interbase 4.0 and 5.0. Maintained by Alexander Kuznetsov.</description> </link> <link href="http://www.informatik.uni-rostock.de/~hme/software/"> <title>Ingres</title> <description>For Ingres 6.4 and OpenIngres, written by Holger Meyer.</description> </link> <link href="http://www.ziclix.com/zxjdbc/"> <title>JDBC (zxJDBC)</title> <description>Provides a DB-API 2.0 interface on top of JDBC and JPython.</description> </link> <link href="http://dustman.net/andy/python/MySQLdb/"> <title>MySQL</title> <description> A MySQL module that is thread-safe and aims for compatibility with the 2.0 DB-API. It requires a newer version of MySQL, version 3.22.19 or higher. </description> </link> <link href="http://starship.python.net/crew/lemburg/mxODBC.html"> <title>mxODBC</title> <description>The mxODBC package provides a nearly 100% Python DB API compliant interface to databases that are accessible via the ODBC API. Many databases include ODBC libraries, so this may be the only module you need; it supports Solid, Adabas, Sybase, Oracle, and even MySQL. Maintained by <a href="http://starship.python.net/crew/lemburg/">M.-A. Lemburg</a>.</description> </link> <link href="http://www.python.org/windows/win32/odbc.html"> <title>ODBC interface</title> <description>This module is currently available in the PythonWin distribution. It's public domain code, but unfortunately has no designated support person(s). The best option for support is to ask questions on the <a href="news:comp.lang.python">comp.lang.python</a> newsgroup, where other PythonWin users can answer them.</description> </link> <link href="http://www.druid.net/pygresql/"> <title>PyGresQL</title> <description> The best-known Python interface to the <a href="http://www.postgresql.org/index.html">PostgresSQL</a> database. DB-API 2.0 compliant. </description> </link> <link href="http://popy.sourceforge.net"> <title>PoPy (PostgreSQL)</title> <description> An interface to PostgreSQL that's DB-API 2.0 compliant and supports thread level 2. </description> </link> <link href="http://initd.org/Software/psycopg"> <title>psycopg (PostgreSQL)</title> <description> A DB-API 2.0 compliant driver designed to support heavily multithreaded applications with many cursors. Cursors can be very short-lived since the driver has an intelligent system for reusing db connections at libpq level. Supports thread level 2. </description> </link> <link href="http://www.object-craft.com.au/projects/sybase/"> <title>Sybase</title> <description> Supports "almost all" of the DB-API 2.0. Maintained by Dave Cole. </description> </link> </section> <section id="persist-dict"> <title>Persistent Dictionaries</title> <description>The modules listed on this page are simply the disk-based equivalent of dictionaries, but many of them have additional features. </description> <link href="http://www.python.org/doc/lib/module-anydbm.html"> <title>anydbm</title> <description>Included with the standard Python distribution. The <code>anydbm</code> module is a generic interface to all the DBM-like modules listed in the next two lines, selecting from whichever modules are installed.</description> </link> <link href="http://www.python.org/doc/lib/module-dbm.html"> <title>dbm</title> <description>XXX Included with the standard Python distribution. Each of these modules is an interface to a specific library.</description> </link> <link href="http://www.python.org/doc/lib/module-gdbm.html"> <title>gdbm</title> <description>XXX</description> </link> <link href="http://www.python.org/doc/lib/module-dbhash.html"> <title>dbhash</title> <description>XXX</description> </link> <link href="http://www.python.org/doc/lib/module-bsddb.html"> <title>bsddb</title> <description>Included with the standard Python distribution. In addition to dictionary-like behaviour, this module also supports B-trees, which allows traversing the keys in sorted order.</description> </link> <link href="http://www.equi4.com/metakit/"> <title>MetaKit</title> <description>MetaKit is a C++ library for storage, transport, and manipulation of structured objects and collections. A Python interface is available.</description> </link> </section> <section id="persist-obj"> <title>Persistent Objects</title> <description> </description> <link href="http://www.python.org/doc/lib/module-pickle.html"> <title>pickle.py</title> <description>Included with the standard Python distribution. The <code>pickle</code> module can convert Python objects to and from a string representation. </description> </link> <link href="http://www.python.org/doc/lib/module-shelve.html"> <title>shelve.py</title> <description>Included with the standard Python distribution. Built on top of the <code>pickle</code> and <code>anydbm</code> modules, the <code>shelve</code> module behaves like a persistent dictionary whose values can be arbitrary Python objects.</description> </link> <link href="http://starship.python.net/crew/jmenzel/"> <title>PyVersant</title> <description>A wrapper for the <a href="http://www.versant.com">Versant commercial OODBMS</a>. XXX link to my hacked version</description> </link> <link href="http://www.amk.ca/zodb/"> <title>ZODB</title> <description>The Zope Object Database is a persistent-object system that provides transparent transactional object persistence to Python applications.</description> </link> </section> <section id="docs"> <title>Database Documentation</title> <description>This page lists documentation that will help you learn about the software packages described in this Topic Guide.</description> <link href="http://www.python.org/windows/win32/odbc.html"> <title>ODBC Documentation</title> <description>The documentation for the PythonWin ODBC module.</description> </link> <link href="http://www.python.org/windows/OdbcHints.html"> <title>ODBC Hints</title> <description>Helpful notes on using ODBC under PythonWin.</description> </link> <link href="http://www.amk.ca/python/writing/DB-API.html"> <title>The Python Database API</title> <description>In <cite>Linux Journal #49</cite>.</description> </link> <link href="http://www.python.org/workshops/1997-10/proceedings/shprentz.html"> <title>"Persistent Storage of Python Objects in Relational Databases"</title> <description>A paper by Joel Shprentz presented at the Sixth Python Conference.</description> </link> </section> <section id="other-db"> <title>Other Database Modules</title> <description> Here are some other interfaces to various relational databases, which don't follow the DB-API interface specification (usually because they predate it). </description> <link href="http://www.matisse.com/python.html"> <title>Matisse</title> <description> Matisse Software provides Python bindings for their object database. </description> </link> <link href="http://www.python.org/ftp/python/contrib/Database/"> <title>mSQL</title> <description>An interface to the mSQL database. Currently without a maintainer. (This points to the ftp directory. The latest version when the link was installed was mSQL.tar.gz.) </description> </link> </section> </topic-guide> |