snipt

Ctrl+h for KB shortcuts
Notice: Snipt is moving away from free accounts on May 1st, 2014. Read more about the transition here.
#2698

Python

Hello world in PyQt through ipython

1
2
3
4
5
6
7
8
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *

app = QApplication(sys.argv)
label = QLabel("Hello world!")
label.show()
label.hide()
https://snipt.net/embed/7a70d60e670a734f2fd22516de915e47/
https://snipt.net/raw/7a70d60e670a734f2fd22516de915e47/
7a70d60e670a734f2fd22516de915e47
python
Python
8
2014-04-23T20:39:38
True
False
/api/public/snipt/2698/
hello-world-in-pyqt-through-ipython
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a> <a href="#L-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="kn">import</span> <span class="nn">sys</span> </span><span id="L-2"><a name="L-2"></a><span class="kn">from</span> <span class="nn">PyQt4.QtCore</span> <span class="kn">import</span> <span class="o">*</span> </span><span id="L-3"><a name="L-3"></a><span class="kn">from</span> <span class="nn">PyQt4.QtGui</span> <span class="kn">import</span> <span class="o">*</span> </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a><span class="n">app</span> <span class="o">=</span> <span class="n">QApplication</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">)</span> </span><span id="L-6"><a name="L-6"></a><span class="n">label</span> <span class="o">=</span> <span class="n">QLabel</span><span class="p">(</span><span class="s">&quot;Hello world!&quot;</span><span class="p">)</span> </span><span id="L-7"><a name="L-7"></a><span class="n">label</span><span class="o">.</span><span class="n">show</span><span class="p">()</span> </span><span id="L-8"><a name="L-8"></a><span class="n">label</span><span class="o">.</span><span class="n">hide</span><span class="p">()</span> </span></pre></div> </td></tr></table>
programming, python, qt