<!DOCTYPE html><!--[if IE 6]><html id="ie6" lang="en-US"><![endif]--><!--[if IE 7]><html id="ie7" lang="en-US"><![endif]--><!--[if IE 8]><html id="ie8" lang="en-US"><![endif]--><!--[if !(IE 6) | !(IE 7) | !(IE 8) ]><!--><html lang="en-US"><!--<![endif]--><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width" /><title>Quick Start | QPyPI</title><link rel="profile" href="http://gmpg.org/xfn/11" /><link rel="stylesheet" type="text/css" media="all" href="https://qpython.com/qrcode/wp-content/themes/twentyeleven/style.css" /><script type='text/javascript' src='//code.jquery.com/jquery-1.8.3.min.js'></script><style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}button {padding: 10px 16px;font-size: 18px;line-height: 1.33;border-radius: 6px;color: #ffffff;background-color: #5cb85c;border-color: #4cae4c;display: inline-block;padding: 6px 12px;margin-bottom: 0;font-size: 14px;font-weight: normal;line-height: 1.428571429;text-align: center;white-space: nowrap;vertical-align: middle;cursor: pointer;background-image: none;border: 1px solid transparent;border-radius: 4px;-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;-o-user-select: none;user-select: none;}</style></head><body class="page page-id-472 page-template-default single-author singular one-column content" style='background:white'><div id="page" class="hfeed"><header id="branding" role="banner" style='border-top:0px'><nav id="access" role="navigation"><div class="menu"></div></nav><!-- #access --></header><!-- #branding --><div id="main" style='padding-top:0px'><div id="primary"><div id="content" role="main"><article id="post-472" class="post-472 page type-page status-publish hentry"><header class="entry-header"><h1 class="entry-title">Quick Start</h1></header><!-- .entry-header --><div class="entry-content" style='padding:0px'><div><h2>A hands-on introduction to Python for beginning programmers</h2><p>If you are a new guy to QPython, you should watch the tutorial video and just follow the steps to learn how to run script with QPython</p><div style='text-align:center'><button style="display:inline" type="submit" value="" class="btn_c" id="step5-btn">Watch Tutorial</button></div></div><div style="padding-top:30px"><h2>Running with Console</h2><p>Running QPython’s simple script with console model</p><pre style="box-shadow:inset 0 1px 1px rgba(0,0,0,0.1);border:1px solid #ddd" id="step1-code">#qpy:2#qpy:console#qpy:http://qpython.com/s/qpy-sample.pyclass Calculator(object):#define class to simulate a simple calculatordef __init__ (self):#start with zeroself.current = 0def add(self, amount):#add number to currentself.current += amountdef getCurrent(self):return self.currentmyBuddy = Calculator() # make myBuddy into a Calculator objectmyBuddy.add(2) #use myBuddy's new add method derived from the Calculator classprint(myBuddy.getCurrent()) #print myBuddy's current instance variable</pre><div style='text-align:center'><button style="display:inline" type="submit" value="" class="btn_c" id="step1-btn">Run ...</button></div></div><div style="padding-top:30px"><h2>Running with Kivy</h2><p>Running QPython’s script with GUI model ( Kivy library )</p><pre style="box-shadow:inset 0 1px 1px rgba(0,0,0,0.1);border:1px solid #ddd" id="step2-code">#qpy:2#qpy:kivy#qpy:http://qpython.com/s/qpy-guisample.pyfrom kivy.app import Appfrom kivy.uix.button import Buttonclass TestApp(App):def build(self):# display a button with the text : Hello QPythonreturn Button(text='Hello QPython')TestApp().run()</pre><div style='text-align:center'><button style="display:inline" type="submit" value="" class="btn_c" id="step2-btn">Run ...</button></div></div><div style="padding-top:30px"><h2>Running as Web App</h2><p>Running Web App with QPython</p><pre style="box-shadow:inset 0 1px 1px rgba(0,0,0,0.1);border:1px solid #ddd" id="step6-code">#qpy:2#qpy:webapp:Hello Qpython#qpy://localhost:8080/hello"""This is a sample for qpython webapp"""from bottle import route, run@route('/hello')def hello():return "Hello World!"run(host='localhost', port=8080)</pre><div style='text-align:center'><button style="display:inline" type="submit" value="Run ..." class="btn_c" id="step6-btn">Run ...</button></div></div><div style='padding:20px'></div><hr /><div style='padding:20px'></div><div style='text-align:center'><button style="display:inline" type="submit" value="" class="btn_c" id="step7-btn">Donate author</button></div><p style='text-align:center'><span id='total'>0</span> pepole donate.Thank you for donating, which should encourage author greatly</p><script>var milib;if (milib==undefined) {var milib = function(){};milib.qeditor = function(str){alert('please open it with QPython browser')};milib.a8playVideoFromGW= function(url){window.open(url)};milib.qpylibinstall = function(cat,url,target){window.open(url)};milib.gotoIfPay = function(url, packageId, packageUrl){window.open(url)};} else {}$(document).ready(function() {$('#step7-btn').click(function(e){milib.openPurchaseActivity('quick-guide');});$('#step1-btn').click(function(e){milib.qeditor($('#step1-code').html())});$('#step2-btn').click(function(e){milib.qeditor($('#step2-code').html())});$('#step6-btn').click(function(e){milib.qeditor($('#step6-code').html())});$('#step3-btn').click(function(e){location.href='http://packages.qpython.org'});$('#step4-btn').click(function(e){location.href='http://wiki.qpython.org'});$('#step5-btn').click(function(e){milib.openUrl("https://m.youtube.com/results?q=python+programming&sm=3");//milib.a8playVideoFromGW('http://www.youtube.com/watch?v=72RKMMyLxS8')//milib.a8playVideoFromGW('http://www.youtube.com/watch?v=N-ae8Q_7iCA')});var total = milib.getPurchaseNumber('quick-start');$('#total').html(total)});</script></p></div><!-- .entry-content --><footer class="entry-meta"></footer><!-- .entry-meta --></article><!-- #post-472 --><div id="comments"></div><!-- #comments --></div><!-- #content --></div><!-- #primary --></div><!-- #main --></div><!-- #page --></body></html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。