<p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:rgb(255,255,255);clear:both;word-wrap:break-word;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:17.27272605895996px">
I'd like to tag items by drawing polygons over an image in Python using PyQt4. I was able to implement the image viewer with QGraphicsScene but I don't understand the concept behind painting/updating objects.</p>
<p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:rgb(255,255,255);clear:both;word-wrap:break-word;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:17.27272605895996px">
What I'd like to do is a Polygon class, what supports adding and editing. What confuses me is the<code style="margin:0px;padding:1px 5px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:rgb(238,238,238);font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;background-repeat:initial initial">QGraphicsScene.addItem</code> and the different paint or update methods. What I'd like to implement is to</p>
<ol style="margin:0px 0px 1em 30px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:rgb(255,255,255);list-style-position:initial;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:17.27272605895996px">
<li style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;word-wrap:break-word;background-repeat:initial initial">draw a polygon as lines while not complete</li>
<li style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;word-wrap:break-word;background-repeat:initial initial">draw it as a filled polygon once complete</li>
</ol><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:rgb(255,255,255);clear:both;word-wrap:break-word;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:17.27272605895996px">
The algorithm part is OK, what I don't understand is that how do I implement the paint or update functions.</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:rgb(255,255,255);clear:both;word-wrap:break-word;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:17.27272605895996px">
<em style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">Here is my confusion</em></p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:rgb(255,255,255);clear:both;word-wrap:break-word;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:17.27272605895996px">
<strong style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">In the original example file</strong>: <code style="margin:0px;padding:1px 5px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:rgb(238,238,238);font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;background-repeat:initial initial">graphicsview/collidingmice</code> there is a special function <code style="margin:0px;padding:1px 5px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:rgb(238,238,238);font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;background-repeat:initial initial">def paint(self, painter, option, widget):</code> what does the painting. There is no function calling the paint function, thus I'd think it's a special name called by QGraphicsView, but I don't understand what is a painter and what should a paint function implement.</p>
<p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:rgb(255,255,255);clear:both;word-wrap:break-word;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:17.27272605895996px">
<strong style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">On the other hand in numerous online tutorials</strong> I find <code style="margin:0px;padding:1px 5px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:rgb(238,238,238);font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;background-repeat:initial initial">def paintEvent(self, event):</code> functions, what seems to follow a totally different concept compared to the graphicsview / paint.</p>
<p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:rgb(255,255,255);clear:both;word-wrap:break-word;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:17.27272605895996px">
Maybe to explain it better: for me <strong style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">the way OpenGL does the scene-update is clear</strong>, where you always clean everything and re-draw elements one by one. There you just take care of what items do you want to draw and draw the appropriate ones. There is no update method, because you are drawing always the most up-to-date state. This Qt GUI way is new to me. <strong style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">Can you tell me what happens with an item after I've added it to the scene</strong>? How do I <strong style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">edit something</strong> what has been added to the scene, <strong style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">where is the always updating 'loop'</strong>?</p>
<p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:rgb(255,255,255);clear:both;word-wrap:break-word;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:17.27272605895996px">
Here is my source in the smallest possible form, it creates the first polygon and starts printing it's points. I've arrived so far that the paint method is called once (why only once?) and there is this error<code style="margin:0px;padding:1px 5px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:rgb(238,238,238);font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;background-repeat:initial initial">NotImplementedError: QGraphicsItem.boundingRect() is abstract and must be overridden</code>. (just copy any jpg file as big.jpg)</p>
<p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:rgb(255,255,255);clear:both;word-wrap:break-word;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:17.27272605895996px">
Thanks, Zsolt</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:rgb(255,255,255);clear:both;word-wrap:break-word;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:17.27272605895996px">
</p><pre class="default prettyprint" style="margin-top:0px;margin-bottom:10px;padding:5px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:rgb(238,238,238);font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;overflow:auto;width:auto;max-height:600px;line-height:17.27272605895996px">
<code style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif"><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">from</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> __future__ </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">import</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> division<br>
<br></span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">import</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> sys<br>
</span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">from</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">PyQt4</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">import</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">QtCore</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">,</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">QtGui</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
<br></span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">class</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">Polygon</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">(</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">QtGui</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">QGraphicsItem</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">):</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
<br> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">def</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> __init__</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">(</span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">):</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
</span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">super</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">(</span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">Polygon</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">,</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">).</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">__init__</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">()</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
<br> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">points </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">=</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">[]</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
</span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">closed </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">=</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">False</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
<br> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">def</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> addpoint</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">(</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">,</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> point </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">):</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
</span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">points</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">append</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">(</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> point </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">)</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
</span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">print</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">points<br>
<br> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">def</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> paint</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">(</span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">,</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> painter</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">,</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> option</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">,</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> widget</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">):</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
</span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">print</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="str" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(128,0,0);background-repeat:initial initial">"paint"</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
<br><br></span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">class</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">MainWidget</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">(</span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">QtGui</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">QWidget</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">):</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
<br> poly_drawing </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">=</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">False</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
<br> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">def</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> __init__</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">(</span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">):</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
</span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">super</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">(</span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">MainWidget</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">,</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">).</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">__init__</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">()</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
<br> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">initUI</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">()</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
<br> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">def</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> initUI</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">(</span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">):</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
<br> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">scene </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">=</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">QtGui</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">QGraphicsScene</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">()</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
<br> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">img </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">=</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">QtGui</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">QPixmap</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">(</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="str" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(128,0,0);background-repeat:initial initial">'big.jpg'</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">)</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
<br> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">view </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">=</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">QtGui</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">QGraphicsView</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">(</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">scene </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">)</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
</span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">view</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">setRenderHint</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">(</span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">QtGui</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">QPainter</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">Antialiasing</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">)</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
</span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">view</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">setHorizontalScrollBarPolicy</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">(</span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">QtCore</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">Qt</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">ScrollBarAlwaysOff</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">)</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
</span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">view</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">setVerticalScrollBarPolicy</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">(</span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">QtCore</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">Qt</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">ScrollBarAlwaysOff</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">)</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
<br> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">pixmap_item </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">=</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">QtGui</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">QGraphicsPixmapItem</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">(</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">img</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">,</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">None</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">,</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">scene</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">)</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
</span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">pixmap_item</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">mousePressEvent </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">=</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">pixelSelect<br>
<br> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">mypoly </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">=</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">Polygon</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">()</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
<br> layout </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">=</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">QtGui</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">QVBoxLayout</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">()</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
layout</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">addWidget</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">(</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">view </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">)</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
</span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">setLayout</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">(</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> layout </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">)</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
</span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">resize</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">(</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="lit" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(128,0,0);background-repeat:initial initial">900</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">,</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="lit" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(128,0,0);background-repeat:initial initial">600</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">)</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
</span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">show</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">()</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
<br> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">def</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> resizeEvent</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">(</span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">,</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">event</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">):</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
w_scale </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">=</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">(</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">view</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">width</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">()</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">)</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">/</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">img</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">width</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">()</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
h_scale </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">=</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">(</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">view</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">height</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">()</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">)</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">/</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">img</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">height</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">()</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
</span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">scale </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">=</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> min</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">(</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> w_scale</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">,</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> h_scale</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">)</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
<br> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">view</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">resetMatrix</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">()</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
</span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">view</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">scale</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">(</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">scale</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">,</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">scale </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">)</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
<br> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">def</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> pixelSelect</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">(</span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">,</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">event</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">):</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
</span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">if</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">not</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">poly_drawing</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">:</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
</span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">poly_drawing </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">=</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">True</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
</span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">mypoly </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">=</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">Polygon</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">()</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
</span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">scene</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">addItem</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">(</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">mypoly </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">)</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
<br> point </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">=</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">event</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">pos</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">()</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
</span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">self</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">mypoly</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">addpoint</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">(</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> point </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">)</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
<br><br></span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">def</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> main</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">():</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
<br> app </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">=</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">QtGui</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">QApplication</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">(</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">sys</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">argv</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">)</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
ex </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">=</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">MainWidget</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">()</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
sys</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">exit</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">(</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">app</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">exec_</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">())</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
<br><br></span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">if</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> __name__ </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">==</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"> </span><span class="str" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent;color:rgb(128,0,0);background-repeat:initial initial">'__main__'</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">:</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent"><br>
main</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13.63636302947998px;vertical-align:baseline;background-color:transparent">()</span></code></pre><p></p>