亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? c653.htm

?? GUI Programming with Python
?? HTM
字號:
<HTML><HEAD><TITLE>Introduction to Python</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.72"><LINKREL="HOME"TITLE="GUI Programming with Python: QT Edition"HREF="book1.htm"><LINKREL="UP"TITLE="Introduction to the BlackAdder IDE"HREF="p266.htm"><LINKREL="PREVIOUS"TITLE="Conclusion"HREF="x650.htm"><LINKREL="NEXT"TITLE="The Rules"HREF="x719.htm"></HEAD><BODYCLASS="CHAPTER"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLESUMMARY="Header navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">GUI Programming with Python: QT Edition</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="x650.htm"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom"></TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="x719.htm"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="CHAPTER"><H1><ANAME="CH24">Chapter 4. Introduction to Python</A></H1><DIVCLASS="TOC"><DL><DT><B>Table of Contents</B></DT><DT><AHREF="c653.htm#AEN663">Programming fundamentals</A></DT><DT><AHREF="x719.htm">The Rules</A></DT><DT><AHREF="x823.htm">Constructions</A></DT><DT><AHREF="x879.htm">Conclusion</A></DT></DL></DIV><P>In this chapter I attempt to explain the    fundamentals of Python. Here I have the same difficulty as Bertie    Wooster faces when he tries to keep us abreast of the developments    in <ICLASS="CITETITLE">Much Obliged, Jeeves</I>. If I start too    early, and begin at the very beginning, telling you all about how    a computer doesn't understand plain English, I'm likely to    irritate the coves who already know all about that, and just want    a quick update on the high-level datastructures of Python and the    current state of iterators and generators. However, that would    leave the birds who are just starting out wondering whether it was    such a good idea, after all, to pick up this book, and start    learning how to program.</P><P>The fact is, writing an introduction to a    complete programming language &#8212; or the concept of    programming in itself &#8212; in just one chapter is the deuce of    a task. It can't really be done, I'm afraid to say. If you already    know a few programming languages, the on-line Python tutorial that    is included with BlackAdder (or with Python itself) will probably    suffice. If you haven't programmed all that much before, I highly    advise you to buy Marc Lutz' excellent book,    <ICLASS="CITETITLE">Learning燩ython</I>, which is more like an    introduction to programming, with a focus on Python.</P><P>Still with me? Then we had better take a    quick tour through Python &#8212; which is really one of the    easiest programming languages to master. Like ancient Gaul, and    like this book, I have divided this chapter into three sections.    The first tries to gently introduce the concept of programming to    people who need to be primed with the most basic concepts. This is    difficult for me to do, because I have been programming since I    was twelve years old, so bear with me. The second is about Rules.    Every programming language needs rules, and these are the rules    that you need to keep in mind while programming Python. The final    part gives an overview of the various constructions that Python    contains for your satisfaction and pleasure.</P><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="AEN663">Programming fundamentals</A></H1><P>Please don't think that I can teach you      programming in just the space of this section &#8212; you need      to read some good books for that, such as Steve McConnel's      <ICLASS="CITETITLE">Code Complete</I>. What I can do is show you      what the fuss is all about.</P><P>Computers do not do anything of their own      volition: ultimately, someone has always told the machine what      to do. Even crashing, down to the ultimate Blue Screen of Death,      is caused by a computer blindly following instructions given by      a human being.</P><P>Instructions can take the form of      mouseclicks on fancy icons or buttons, or of bits of text the      computer can understand. While there is still no computer that      can understand plain English, there are many sub-dialects of      English that a computer can understand. Python is one of these      &#8212; a mix between pidgin English and mathematical notation.      It is close to both the way computers work, and the way people      think.</P><P>Unless you have a speech-to-text interface      for your computer, you will have to type out all the      pidgin-English, and then tell the computer to read what you've      written, and do what you told it to. In a sense, you have to      write a kind of manual for the computer to read, on how to      perform a certain task.</P><P>Let's start with a simple example: fire up      BlackAdder, and open the Python Interpreter window. If you start      typing at the <TTCLASS="PROMPT">&#62;&#62;&#62;</TT>, nothing will happen      &#8212; only by pressing the Enter key will Python realize that      it has been spoken to. Go ahead and type something &#8212; you      can't hurt the computer or your system, except if, by a fluke,      you type <TTCLASS="USERINPUT"><B>import os</B></TT>, followed by Enter and      <TTCLASS="USERINPUT"><B>os.system("deltree c:")</B></TT> &#8212; which      would radically clean out your C drive. So don't do this! On the      other hand, asking Python about the captain's age or the      contents of a bathtub that's being filled by two taps is all      right.</P><P>Chances are very small that you will have      hit upon something Python understands by accident, for you are      strictly limited to the few <SPAN><ICLASS="EMPHASIS">keywords</I></SPAN> Python      actually knows about. Most of these keywords are concerned with      creating <SPAN><ICLASS="EMPHASIS">blocks</I></SPAN> of instructions, called      functions. Functions are used to construct more complex systems.      Other keywords are used for creating another kind of block,      called classes, which are combinations of information and      instructions.</P><P>Let's construct a class that knows the      value of something (though not the price), and has a function      that does something to that value. Remember to press enter at      the end of each line, and don't type the three &#62; signs or the      three dots &#8212; Python does this for you.</P><PRECLASS="SCREEN">Python 2.1.1 (#1, Aug 11 2001, 20:14:53) [GCC 2.95.2 19991024(release)] on linux2 Type "copyright", "credits" or "license"for more information.&#62;&#62;&#62; class FirstClass:...     def __init__(self, value):...             self.item=value...     def printValue(self):...             print self.item...&#62;&#62;&#62; firstObject=FirstClass(value="BlackAdder goes forth")&#62;&#62;&#62; firstObject.printValue&#60;method FirstClass.printValue of FirstClass instance at 0x80db1f4&#62;&#62;&#62;&#62; firstObject.printValue()BlackAdder goes forth&#62;&#62;&#62;    </PRE><P>If you type neatly and without mistakes,      the contents of the Python interpreter window might look like      this. Let's look at what happens: we have defined a &#8216;class'      &#8212; that's a combination of information and complex actions      that work on the contained information. The class has a name:      <TTCLASS="VARNAME">FirstClass</TT>. (It is customary to capitalize      the first letter of each word in a classname).</P><P>A class in itself is only the      &#8216;template', so to speak, while an object is the      &#8216;document' &#8212; just as you can make documents out of      templates in a wordprocessor, you can make objects from      classes.</P><P>Furthermore, the class has two      &#8216;functions' &#8212; defined with the      <TTCLASS="FUNCTION">def</TT> statement.    </P><P>The first function,      <TTCLASS="FUNCTION">__init__</TT>, is called when you want to create      an object. The function has two &#8216;parameters' &#8212; that is,      two names associated with a value (which we call a &#8216;variable'      because the value can change, though the name remains the same).      The first parameter refers to the object &#8212; it's always      called <TTCLASS="VARNAME">self</TT> in Python (though it is called      <TTCLASS="VARNAME">this</TT> in Java or C++). The second parameter is      the value we want the object to manage for us.</P><P>You can use a dot &#8216;.' to associate      variables with each other. The line &#8216;self.item = value' means      that from now on the object we refer to with      <TTCLASS="VARNAME">self</TT> (but also, in another context, with      <TTCLASS="VARNAME">firstObject</TT>) knows that the name      <TTCLASS="VARNAME">item</TT> is associated with the value represented      by the parameter <TTCLASS="VARNAME">value</TT>.</P><P>Cleverly, Python doesn't forget this, so      when you create an object with the name      <TTCLASS="VARNAME">firstObject</TT> and the      <SPAN><ICLASS="EMPHASIS">string</I></SPAN> value (that is to say, some text, as      opposed to a number) &#8216;BlackAdder goes forth', you can later call      the <TTCLASS="FUNCTION">printValue()</TT> function, which will be      able to do something with that value.</P><P>In order to call&#8212;that is, ask Python to      execute&#8212; a function, you must add brackets after the      function name; the parameters always go between the brackets.      You don't have to put <TTCLASS="VARNAME">self</TT> between brackets, for      Python does this for you. If you don't add the brackets, you are      <SPAN><ICLASS="EMPHASIS">referring to</I></SPAN> the function, not asking      Python to execute it. Python then answers you with the revealing      sentence:</P><PRECLASS="SCREEN">&#62;&#62;&#62; firstObject.printValue&#60;method FirstClass.printValue of FirstClass instance at 0x80db1f4&#62;    </PRE><P>This tells you what kind of an object a      function is. <SPAN><ICLASS="EMPHASIS">Calling</I></SPAN> the function will      &#8216;print' the value of <TTCLASS="VARNAME">item</TT> in your      window:</P><PRECLASS="SCREEN">&#62;&#62;&#62; firstObject.printValue()BlackAdder goes forth&#62;&#62;&#62;    </PRE><P>As I said, the <TTCLASS="VARNAME">self</TT> is      supplied by Python, because you call the function from the      object. That is, by prefixing the variable that points to the      object to the function name, with a dot in between. This is the      same as typing the following code (that is, calling the function      with the object as its first parameter). As such, the following      two expressions are equivalent:</P><PRECLASS="SCREEN">&#62;&#62;&#62;firstObject.printValue()BlackAdder goes forth&#62;&#62;&#62;FirstClass.printValue(firstObject)BlackAdder goes forth    </PRE><P>Of course, typing in all these      instructions correctly every time you want the computer to print      &#8216;BlackAdder goes forth' is quite a chore. To get around this,      you can write a small text document (this is not the same as a      Word document!) using BlackAdder's text editor, and then ask      Python to execute it.</P><P>To sum up: composition of complex wholes      from smaller parts using a debased variant of English, and      calling things names, is what programming is all about. The rest      is made up of rules &#8212;rules intended to make it easier for      computer the compute to determine what it should do, and more      difficult for you to explain yourself to the machine.</P><DIVCLASS="WARNING"><P></P><TABLECLASS="WARNING"BORDER="1"WIDTH="100%"><TR><TDALIGN="CENTER"><B>Warning</B></TD></TR><TR><TDALIGN="LEFT"><P>Please be warned that if you execute        your programs (or scripts) from BlackAdder, all the output of        &#8216;print' will disappear into the void. The output will        only be shown if you start your scripts using the debugger,        and have the Python Interpreter window open. If you merely        type in stuff in the Interpreter window you will see all        output.</P></TD></TR></TABLE></DIV><P>If this section went over your head with      the airspeed of an unladen African swallow, don't worry. There      is much more to programming &#8212; more than I can explain in a      third of a chapter. Please read the Python tutorial that is      included with Python and with BlackAdder. It is well-written and      a little less hasty. Another good source is the free Livewires      Python course, which you can find in PDF format at:      http://www.livewires.org.uk/python/. I heartily recommend it as      the best introduction to the general idea of programming I've      ever read.</P></DIV></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLESUMMARY="Footer navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="x650.htm"ACCESSKEY="P">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="book1.htm"ACCESSKEY="H">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="x719.htm"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Conclusion</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="p266.htm"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">The Rules</TD></TR></TABLE></DIV></BODY></HTML>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
肉肉av福利一精品导航| 精品一区二区在线看| 一区二区三区四区精品在线视频| **网站欧美大片在线观看| 亚洲色图清纯唯美| 亚洲一区二区高清| 亚洲精品国产无天堂网2021| 亚洲成av人片一区二区梦乃| 午夜久久久影院| 麻豆国产一区二区| 成人av动漫网站| 欧美性生活影院| 欧美一区二区三区喷汁尤物| 久久久一区二区三区| 国产午夜三级一区二区三| 亚洲人亚洲人成电影网站色| 亚洲专区一二三| 蜜臀av亚洲一区中文字幕| 国产99久久久久| 在线观看欧美精品| 欧美videos中文字幕| 亚洲视频一区二区免费在线观看 | 久久国产精品免费| 国产福利精品一区二区| 在线精品视频一区二区三四| 精品久久久久久久一区二区蜜臀| 国产精品美女久久久久高潮| 亚洲丰满少妇videoshd| 精品一区二区三区免费视频| 国产一区二区按摩在线观看| 成人一区在线看| 91成人国产精品| 久久久欧美精品sm网站| 亚洲香蕉伊在人在线观| 国产福利一区在线| 欧美午夜不卡视频| 欧美国产乱子伦| 午夜精品久久久久久久久久| 成人高清视频在线| 日韩美女主播在线视频一区二区三区| 中文字幕欧美激情| 天涯成人国产亚洲精品一区av| 国产激情视频一区二区三区欧美| 欧美视频在线一区| 国产精品丝袜91| 久久99精品一区二区三区| 在线免费精品视频| 欧美激情在线一区二区| 免费高清视频精品| 日本国产一区二区| 国产精品亲子乱子伦xxxx裸| 老司机精品视频导航| 北岛玲一区二区三区四区| 欧美一区二区三区四区五区| 国产精品网站一区| 麻豆国产91在线播放| 在线国产亚洲欧美| 亚洲三级在线免费观看| 国产一本一道久久香蕉| 91.xcao| 亚洲一区中文日韩| 成人动漫av在线| 欧美精品一区二区在线观看| 五月婷婷综合网| 欧洲日韩一区二区三区| 中文字幕一区二区三区四区不卡| 国产老肥熟一区二区三区| 51午夜精品国产| 亚洲一线二线三线视频| 91香蕉国产在线观看软件| 中文字幕不卡的av| 国产精品1024| 日韩精品最新网址| 日日夜夜精品视频免费| 99re成人精品视频| 国产人久久人人人人爽| 国产一区二区三区国产| 亚洲精品在线电影| 蜜桃一区二区三区在线观看| 欧美精品第一页| 午夜精品免费在线| 欧美三级三级三级爽爽爽| 亚洲午夜av在线| 欧美在线色视频| 亚洲精品一卡二卡| 91日韩精品一区| 一区二区三区视频在线看| 波多野结衣在线aⅴ中文字幕不卡 波多野结衣在线一区 | 91在线porny国产在线看| 欧美一二三区精品| 热久久免费视频| 欧美大黄免费观看| 午夜一区二区三区在线观看| 欧美日韩国产免费一区二区| 亚洲福利视频导航| 91精品福利在线一区二区三区| 天天操天天干天天综合网| 欧美日韩免费观看一区三区| 亚洲自拍偷拍九九九| 欧美日韩国产精品自在自线| 亚洲成年人影院| 欧美日韩精品一区二区天天拍小说| 亚洲一卡二卡三卡四卡五卡| 欧美三级欧美一级| 日韩精品乱码av一区二区| 欧美电影免费观看完整版| 国产精品系列在线观看| 国产精品久久影院| 欧洲人成人精品| 秋霞午夜鲁丝一区二区老狼| 精品国产免费久久| 国产精品亚洲一区二区三区妖精| 国产精品三级视频| 91极品视觉盛宴| 日日夜夜免费精品| 26uuu精品一区二区在线观看| 成人国产一区二区三区精品| 一区二区在线看| 在线不卡免费欧美| 国产一区二区不卡老阿姨| 18成人在线观看| 欧美日韩大陆在线| 国产精品综合网| 亚洲精品视频在线观看网站| 91精品久久久久久久99蜜桃| 国内成人精品2018免费看| 国产精品污www在线观看| 在线观看日韩国产| 日韩va欧美va亚洲va久久| 欧美成人精精品一区二区频| 不卡在线观看av| 亚洲超丰满肉感bbw| 久久精品一区二区三区四区| 欧美主播一区二区三区| 激情六月婷婷久久| 亚洲精品成人在线| 337p日本欧洲亚洲大胆色噜噜| 91免费国产在线| 久久精品国产免费| 玉米视频成人免费看| 日韩欧美一区二区在线视频| 成人ar影院免费观看视频| 日韩国产精品久久久久久亚洲| 欧美国产精品劲爆| 欧美一区二区免费视频| eeuss鲁片一区二区三区| 亚洲永久精品大片| 国产三区在线成人av| 欧美三级资源在线| 国产**成人网毛片九色 | 成人精品电影在线观看| 日韩国产精品久久| 日韩一区在线免费观看| 日韩视频免费观看高清完整版在线观看 | 欧美日韩亚洲综合一区二区三区| 国产麻豆精品久久一二三| 亚洲国产cao| 中文字幕日韩av资源站| 日韩一区二区三区视频在线| 91丨九色丨蝌蚪富婆spa| 国产精品一二三在| 免费看日韩a级影片| 夜色激情一区二区| 日本人妖一区二区| 亚洲品质自拍视频| 国产精品网曝门| 国产精品视频一二三区 | av高清久久久| 成人毛片老司机大片| 国产**成人网毛片九色 | 亚洲精品写真福利| 亚洲精品水蜜桃| 亚洲免费观看在线视频| 亚洲乱码国产乱码精品精的特点 | av亚洲精华国产精华精华| 国产成人精品亚洲日本在线桃色 | 国产调教视频一区| 国产欧美日韩三级| 国产精品婷婷午夜在线观看| 国产免费观看久久| 国产精品国产自产拍高清av | 色噜噜狠狠成人网p站| 色婷婷综合久久久| 欧美在线色视频| 欧美日韩亚洲综合在线 | 免费成人小视频| 麻豆成人久久精品二区三区红| 另类小说综合欧美亚洲| 国产呦精品一区二区三区网站| 国产在线一区观看| 成人中文字幕合集| 91亚洲午夜精品久久久久久| 91成人看片片| 欧美三级电影在线看| 日韩一级片在线播放| 久久一夜天堂av一区二区三区| 国产女主播一区| 亚洲精品一二三| 日韩精品免费专区| 久久66热偷产精品|