[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] Using Python's "print" or sys.stdout.write( "str" ) inside
From:       "Peter Lindener" <lindener.peter () gmail ! com>
Date:       2008-09-25 20:40:11
Message-ID: cbb13e980809251340o3eb47917s8c5dba2d662b3565 () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi
   Hans-

   I guess there were two problems regarding the code I attached to the last
message, and yes you are correct that this seems an issue mostly with using
IDLE.

   Once I had shifted IDE's, at that moment to SciTE because I had it on my
machine.  I was missing a python error printout due to the need for a
missing "GL." in front of the new OpenGL calls I had written.   I gather one
of the reasons the error print out was lost with IDLE had something to do
with the code being invoked inside of "GLWidget.paintGL()".  I think some of
this may have to do with threading or call back related issues.  In any case
the "print"/stdout problem also seems to manifest from inside of SciTE....
I have not yet tested ERIC and the other Python IDEs.

   In any case, now that the code has the proper name-space designators....
All seems well when this PyQtOpenGL example program is invoked stand alone.
Further more, if I write to a Log file instead of "print" or
"sys.stdout.write()"
from inside of GLWidget.paintGL() all seems well even inside of IDLE.
"raw_input()" in the main program flow, seems to be working inside of IDLE.

   I noted an anomalistic behavior as the original "hellogl.pyw" demo
program did not, as I received it, call "window.close()",   I found the
python code completing in an orderly fashion along with it's closing
printout, and back at the IDLE prompt...and still, the QT based OpenGL
interactive demo window open and remaining responsive..... I'm not sure this
is because there is more than one thread behind the scenes, or the nature of
the Qt's signal/slot mechanism as a call-back like form of flow
control.....still trying to grok the big picture here.

   I have cleaned up my code in the attached "print" bug example and added
some comments at the front such that it might be a useful example to others
who might be able to figure out how to make the Python environment we all
have learned to love all that much better.

   Thanks for writing back!
        -Peter Lindener



On Thu, Sep 25, 2008 at 6:14 AM, Hans-Peter Jansen <hpj@urpla.net> wrote:

> Am Donnerstag, 25. September 2008 schrieb Peter Lindener:
> > Dear
> >    PyQt4 developers -
> >
> >   I am currently running Python 2.5,2, with IDLE version 1.2.2 under
> > Win_XP.
> >
> >   I'm new to using PyQt along with PyOpenGL. I have searched a bit and
> > surprised, I was unable to find the answer to my most basic question
> > concerning the functionality of Python's print statement when running the
> > PyQt4_OpenGL demo from Python's default interaction shell, IDLE.  It
> > seems that Qt's interaction loop freezes up once the stdout buffer is
> > perhaps full?,  in any case,  using Python print statements from inside a
> > PyQt program seems to need more supporting infrastructure than that
> > included in the attached PyQtOpenGL demo..
> >
> > Print statements on lines 53-62 of the attached program are currently
> > commented out,
> >  such that it runs much like the original "hellogl.py" demo typically
> > found on the path:
> >
> > C:\Python25\Lib\site-packages\PyQt4\examples\opengl.py
> >
> >    If one reintroduces these "print" and/or "sys.stdout.write()" program
> > lines, one does find some of the text making it back to IDLE's Python
> > shell window...  but soon enough we seem to encounter program interaction
> > death.....
> >
> >    I have heard from some that Python's default interaction shell IDLE is
> > not all so well equipped to make all of this work,  Perhaps I may need to
> > be looking at using a different development shell or IDE?,  is there a
> > common denominator as to how stdout and stdin are supposed to work in a
> > Python environment, and do most of them handle it in the same way....it
> > seems like some of this may still require some further development of
> > either the IDE's involved, PyQt4 or perhaps Qt4, depending on where best
> > to fix this problem...any suggestions?
>
> I do use stdout/stderr all the time (or module logging in more advanced
> projects) but IDLE and XP are missing in the equation here. It definitely
> sounds like an IDLE problem - try to run your scripts in a cmd shell
> directly.
>
> If you are in need for an IDE, try eric. It shouldn't suffer from those
> issues, but I always use a separate unix shell in an xterm with eric side
> by side, since I use varying command line parameters and a huge backlog
> buffer all the time..
>
> >    I gather there may be an easy way to establish a Qt window for
> > displaying the stdout stream, and /or a way to keep Python's print
> > statements working as they typically do inside Python's interaction
> > shell.....   It would be great if likewise, some of Python's default
> > keyboard/ "rawinput()" and sys.stdin.read()" inputput logic also could
> > work as python programmers are familiar..   I'm sure this is covered
> > somewhere, perhaps partly in Qt4's doc's, and perhaps somewhere in PyQt's
> > notes.... a pointer to any related documentation would be great!
>
> You're mixing different "universes" here, while you should decide on one,
> at
> least when it comes to interactive input processing. Mixing those will
> never play well..
>
> >    Please forgive me for not yet understanding the nuance of this,  I'm
> > still pretty new to using PyQt along with OpenGL.
> >
> >    Thanks ahead of time for any assistance you may provide.
> >        All the best
> >             -Peter
>
> Cheers,
> Pete
> _______________________________________________
> PyQt mailing list    PyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>

[Attachment #5 (text/html)]

<div dir="ltr">Hi<br>&nbsp;&nbsp; Hans-<br><br>&nbsp;&nbsp; I guess there were two \
problems regarding the code I attached to the last message, and yes you are correct \
that this seems an issue mostly with using IDLE.<br><br>&nbsp;&nbsp; Once I had \
shifted IDE&#39;s, at that moment to SciTE because I had it on my machine.&nbsp; I \
was missing a python error printout due to the need for a missing &quot;GL.&quot; in \
front of the new OpenGL calls I had written.&nbsp;&nbsp; I gather one of the reasons \
the error print out was lost with IDLE had something to do with the code being \
invoked inside of &quot;GLWidget.paintGL()&quot;.&nbsp; I think some of this may have \
to do with threading or call back related issues.&nbsp; In any case the \
&quot;print&quot;/stdout problem also seems to manifest from inside of \
SciTE....&nbsp; I have not yet tested ERIC and the other Python IDEs.<br> \
<br>&nbsp;&nbsp; In any case, now that the code has the proper name-space \
designators....&nbsp; All seems well when this PyQtOpenGL example program is invoked \
stand alone.&nbsp; Further more, if I write to a Log file instead of \
&quot;print&quot; or &quot;sys.stdout.write()&quot;<br> from inside of \
GLWidget.paintGL() all seems well even inside of IDLE. &quot;raw_input()&quot; in the \
main program flow, seems to be working inside of IDLE.<br><br>&nbsp;&nbsp; I noted an \
anomalistic behavior as the original &quot;hellogl.pyw&quot; demo program did not, as \
I received it, call &quot;window.close()&quot;,&nbsp;&nbsp; I found the python code \
completing in an orderly fashion along with it&#39;s closing printout, and back at \
the IDLE prompt...and still, the QT based OpenGL interactive demo window open and \
remaining responsive..... I&#39;m not sure this is because there is more than one \
thread behind the scenes, or the nature of the Qt&#39;s signal/slot mechanism as a \
call-back like form of flow control.....still trying to grok the big picture \
here.<br> <br>&nbsp;&nbsp; I have cleaned up my code in the attached \
&quot;print&quot; bug example and added some comments at the front such that it might \
be a useful example to others who might be able to figure out how to make the Python \
environment we all have learned to love all that much better.<br> <br>&nbsp;&nbsp; \
Thanks for writing back!<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -Peter \
Lindener<br><br><br><br><div class="gmail_quote">On Thu, Sep 25, 2008 at 6:14 AM, \
Hans-Peter Jansen <span dir="ltr">&lt;<a \
href="mailto:hpj@urpla.net">hpj@urpla.net</a>&gt;</span> wrote:<br> <blockquote \
class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt \
0pt 0.8ex; padding-left: 1ex;">Am Donnerstag, 25. September 2008 schrieb Peter \
Lindener:<br> <div><div></div><div class="Wj3C7c">&gt; Dear<br>
&gt; &nbsp; &nbsp;PyQt4 developers -<br>
&gt;<br>
&gt; &nbsp; I am currently running Python 2.5,2, with IDLE version 1.2.2 under<br>
&gt; Win_XP.<br>
&gt;<br>
&gt; &nbsp; I&#39;m new to using PyQt along with PyOpenGL. I have searched a bit \
and<br> &gt; surprised, I was unable to find the answer to my most basic question<br>
&gt; concerning the functionality of Python&#39;s print statement when running \
the<br> &gt; PyQt4_OpenGL demo from Python&#39;s default interaction shell, IDLE. \
&nbsp;It<br> &gt; seems that Qt&#39;s interaction loop freezes up once the stdout \
buffer is<br> &gt; perhaps full?, &nbsp;in any case, &nbsp;using Python print \
statements from inside a<br> &gt; PyQt program seems to need more supporting \
infrastructure than that<br> &gt; included in the attached PyQtOpenGL demo..<br>
&gt;<br>
&gt; Print statements on lines 53-62 of the attached program are currently<br>
&gt; commented out,<br>
&gt; &nbsp;such that it runs much like the original &quot;hellogl.py&quot; demo \
typically<br> &gt; found on the path:<br>
&gt;<br>
&gt; C:\Python25\Lib\site-packages\PyQt4\examples\opengl.py<br>
&gt;<br>
&gt; &nbsp; &nbsp;If one reintroduces these &quot;print&quot; and/or \
&quot;sys.stdout.write()&quot; program<br> &gt; lines, one does find some of the text \
making it back to IDLE&#39;s Python<br> &gt; shell window... &nbsp;but soon enough we \
seem to encounter program interaction<br> &gt; death.....<br>
&gt;<br>
&gt; &nbsp; &nbsp;I have heard from some that Python&#39;s default interaction shell \
IDLE is<br> &gt; not all so well equipped to make all of this work, &nbsp;Perhaps I \
may need to<br> &gt; be looking at using a different development shell or IDE?, \
&nbsp;is there a<br> &gt; common denominator as to how stdout and stdin are supposed \
to work in a<br> &gt; Python environment, and do most of them handle it in the same \
way....it<br> &gt; seems like some of this may still require some further development \
of<br> &gt; either the IDE&#39;s involved, PyQt4 or perhaps Qt4, depending on where \
best<br> &gt; to fix this problem...any suggestions?<br>
<br>
</div></div>I do use stdout/stderr all the time (or module logging in more \
advanced<br> projects) but IDLE and XP are missing in the equation here. It \
definitely<br> sounds like an IDLE problem - try to run your scripts in a cmd \
shell<br> directly.<br>
<br>
If you are in need for an IDE, try eric. It shouldn&#39;t suffer from those<br>
issues, but I always use a separate unix shell in an xterm with eric side<br>
by side, since I use varying command line parameters and a huge backlog<br>
buffer all the time..<br>
<div class="Ih2E3d"><br>
&gt; &nbsp; &nbsp;I gather there may be an easy way to establish a Qt window for<br>
&gt; displaying the stdout stream, and /or a way to keep Python&#39;s print<br>
&gt; statements working as they typically do inside Python&#39;s interaction<br>
&gt; shell..... &nbsp; It would be great if likewise, some of Python&#39;s \
default<br> &gt; keyboard/ &quot;rawinput()&quot; and sys.stdin.read()&quot; inputput \
logic also could<br> &gt; work as python programmers are familiar.. &nbsp; I&#39;m \
sure this is covered<br> &gt; somewhere, perhaps partly in Qt4&#39;s doc&#39;s, and \
perhaps somewhere in PyQt&#39;s<br> &gt; notes.... a pointer to any related \
documentation would be great!<br> <br>
</div>You&#39;re mixing different &quot;universes&quot; here, while you should decide \
on one, at<br> least when it comes to interactive input processing. Mixing those \
will<br> never play well..<br>
<div class="Ih2E3d"><br>
&gt; &nbsp; &nbsp;Please forgive me for not yet understanding the nuance of this, \
&nbsp;I&#39;m<br> &gt; still pretty new to using PyQt along with OpenGL.<br>
&gt;<br>
&gt; &nbsp; &nbsp;Thanks ahead of time for any assistance you may provide.<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp;All the best<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -Peter<br>
<br>
</div>Cheers,<br>
Pete<br>
_______________________________________________<br>
PyQt mailing list &nbsp; &nbsp;<a \
href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><br> <a \
href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" \
target="_blank">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br> \
</blockquote></div><br></div>


["Hello_PyQtOpenGL_PL.py" (text/plain)]

#!/usr/bin/env python

print "--- Hello_PyQtOpenGL_PL.py ------------------------------------"
print

"""PyQt4 port of the opengl/hellogl example from Qt v4.x"""

"""
This code is a minor modification by PL. of the PyQt4 example code typicaly found on \
the path: C:\Python25\Lib\site-packages\PyQt4\examples\opengl\hellogl.py

It has been modifyed to "print" out (or log to a file) the values of the OpenGL \
trasnformation Matrixs. This value logging is envoked inside the Qt4 \
"GLWidget.paintGL()" call back method.

Bug --> Apparently using print statments at this point in the demo program's flow \
does not work also so well when one is working inside of Python's default develpment \
enviroment IDLE (Python 2.5,2, with IDLE version 1.2.2 under Win_XP-sp2). While these \
print statments still seems to work with the Python interpreter when involked stand \
alone.  I also note that "sys.stdout.write()" also fails, and Python's error \
reporting fails to display within IDLE when there are failyers in this same part of \
the code.

The above IDLE/PyQt/OpenGL print bug is clearly is an isssue if we want to think of \
one of Python's vertues as being that of highly interactive visual code development.

Other minor changes to the code:
    Opening and Closing program name print statments,
    Import from numpy
    Added raw_input() wait for [Enter] and then
    A call to window.close() to properly clean up PyQt at end of program 

"""

# LogFileName = None             # "print" Does not work inside of Python's IDLE
LogFileName = "stdout"         # a clue.. ..sys.stdout.write() does not work either

# LogFileName = "Log.txt"      # Works inside with IDLE


print "LogFileName: %s" % ( LogFileName )

#-------    

def Log_String( String, InitFile=False ) :
    if(   LogFileName == None )     :  print String
    
    elif( LogFileName == "stdout" ) :  sys.stdout.write( String )

    else :    
        LogFile = open( "Log.txt", 'w' if(InitFile) else 'a' )
        LogFile.write( String + '\n' )
        LogFile.close()


#---

import sys
import math
from   numpy import int32

#---

from   PyQt4 import QtCore, QtGui, QtOpenGL

try:
    from OpenGL import GL
    
except ImportError:
    app = QtGui.QApplication(sys.argv)
    QtGui.QMessageBox.critical(None, "OpenGL hellogl",
                            "PyOpenGL must be installed to run this example.",
                            QtGui.QMessageBox.Ok | QtGui.QMessageBox.Default,
                            QtGui.QMessageBox.NoButton)
    sys.exit(1)


#----------------------------------

def Get_OpenGL_ModelViewMat() :    
    Mat4x4 = GL.glGetFloatv( GL.GL_MODELVIEW_MATRIX )
    return( Mat4x4.T )

def Get_OpenGL_ProjectionMat() :    
    Mat4x4 = GL.glGetFloatv( GL.GL_PROJECTION_MATRIX )
    return( Mat4x4.T )

#-------

def Set_OpenGL_ModelViewMat( Mat4x4 ) :    
    GL.glMatrixMode( GL_MODELVIEW )          # Set stupped Open_GL Matrix access \
state  GL.glLoadMatrix( Mat4x4.T )

def Set_OpenGL_ProjectionMat( Mat4x4 ) :    
    GL.glMatrixMode( GL_PROJECTION )         # Set stupped Open_GL Matrix access \
state  GL.glLoadMatrix( Mat4x4.T )

#----

def Log_OpenGL_Matrixs() :
    ModVMatStr = "GL_ModelViewMat:\n%s\n"  % ( int32(Get_OpenGL_ModelViewMat() *100) \
)   ProjMatStr = "GL_ProjectionMat:\n%s\n" % ( int32(Get_OpenGL_ProjectionMat()*100) \
)   Log_String( ModVMatStr + ProjMatStr )

    return

    
#-----------------------------------------------------------------------------

class Window(QtGui.QWidget):
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)

        self.glWidget = GLWidget()

        self.xSlider = self.createSlider(QtCore.SIGNAL("xRotationChanged(int)"),
                                         self.glWidget.setXRotation)
        self.ySlider = self.createSlider(QtCore.SIGNAL("yRotationChanged(int)"),
                                         self.glWidget.setYRotation)
        self.zSlider = self.createSlider(QtCore.SIGNAL("zRotationChanged(int)"),
                                         self.glWidget.setZRotation)

        mainLayout = QtGui.QHBoxLayout()
        mainLayout.addWidget(self.glWidget)
        mainLayout.addWidget(self.xSlider)
        mainLayout.addWidget(self.ySlider)
        mainLayout.addWidget(self.zSlider)
        self.setLayout(mainLayout)

        self.xSlider.setValue(15 * 16)
        self.ySlider.setValue(345 * 16)
        self.zSlider.setValue(0 * 16)

        self.setWindowTitle(self.tr("Hello_PyQtOpenGL"))
        

    def createSlider(self, changedSignal, setterSlot):
        slider = QtGui.QSlider(QtCore.Qt.Vertical)

        slider.setRange(0, 360 * 16)
        slider.setSingleStep(16)
        slider.setPageStep(15 * 16)
        slider.setTickInterval(15 * 16)
        slider.setTickPosition(QtGui.QSlider.TicksRight)

        self.glWidget.connect(slider, QtCore.SIGNAL("valueChanged(int)"), setterSlot)
        self.connect(self.glWidget, changedSignal, slider, \
QtCore.SLOT("setValue(int)"))

        return slider
    
#------

class GLWidget(QtOpenGL.QGLWidget):
    def __init__(self, parent=None):
        QtOpenGL.QGLWidget.__init__(self, parent)

        self.object = 0
        self.xRot = 0
        self.yRot = 0
        self.zRot = 0

        self.lastPos = QtCore.QPoint()

        self.trolltechGreen  = QtGui.QColor.fromCmykF(0.40, 0.0,  1.0, 0.0)
        self.trolltechPurple = QtGui.QColor.fromCmykF(0.39, 0.39, 0.0, 0.0)

    def xRotation(self):
        return self.xRot

    def yRotation(self):
        return self.yRot

    def zRotation(self):
        return self.zRot

    def minimumSizeHint(self):
        return QtCore.QSize(50, 50)

    def sizeHint(self):
#       return QtCore.QSize(400, 400)
        return QtCore.QSize(800, 800)      # Larger inital window, PL.

    def setXRotation(self, angle):
        angle = self.normalizeAngle(angle)
        if angle != self.xRot:
            self.xRot = angle
            self.emit(QtCore.SIGNAL("xRotationChanged(int)"), angle)
            self.updateGL()

    def setYRotation(self, angle):
        angle = self.normalizeAngle(angle)
        if angle != self.yRot:
            self.yRot = angle
            self.emit(QtCore.SIGNAL("yRotationChanged(int)"), angle)
            self.updateGL()

    def setZRotation(self, angle):
        angle = self.normalizeAngle(angle)
        if angle != self.zRot:
            self.zRot = angle
            self.emit(QtCore.SIGNAL("zRotationChanged(int)"), angle)
            self.updateGL()

    def initializeGL(self):
        self.qglClearColor(self.trolltechPurple.dark())
        self.object = self.makeObject()
        GL.glShadeModel(GL.GL_FLAT)
        GL.glEnable(GL.GL_DEPTH_TEST)
        GL.glEnable(GL.GL_CULL_FACE)

    def paintGL(self):
        GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT)
        GL.glLoadIdentity()
        GL.glTranslated(0.0, 0.0, -10.0)
        GL.glRotated(self.xRot / 16.0, 1.0, 0.0, 0.0)
        GL.glRotated(self.yRot / 16.0, 0.0, 1.0, 0.0)
        GL.glRotated(self.zRot / 16.0, 0.0, 0.0, 1.0)
#---------       
        Log_OpenGL_Matrixs()        # For debuging Python side OpenGL matrix \
creation, PL. #---------
        GL.glCallList(self.object)

    def resizeGL(self, width, height):
        side = min(width, height)
        GL.glViewport((width - side) / 2, (height - side) / 2, side, side)

        GL.glMatrixMode(GL.GL_PROJECTION)
        GL.glLoadIdentity()
        GL.glOrtho(-0.5, +0.5, +0.5, -0.5, 4.0, 15.0)
        GL.glMatrixMode(GL.GL_MODELVIEW)

    def mousePressEvent(self, event):
        self.lastPos = QtCore.QPoint(event.pos())

    def mouseMoveEvent(self, event):
        dx = event.x() - self.lastPos.x()
        dy = event.y() - self.lastPos.y()

        if event.buttons() & QtCore.Qt.LeftButton:
            self.setXRotation(self.xRot + 8 * dy)
            self.setYRotation(self.yRot + 8 * dx)
        elif event.buttons() & QtCore.Qt.RightButton:
            self.setXRotation(self.xRot + 8 * dy)
            self.setZRotation(self.zRot + 8 * dx)

        self.lastPos = QtCore.QPoint(event.pos())

    def makeObject(self):
        genList = GL.glGenLists(1)
        GL.glNewList(genList, GL.GL_COMPILE)

        GL.glBegin(GL.GL_QUADS)

        x1 = +0.06
        y1 = -0.14
        x2 = +0.14
        y2 = -0.06
        x3 = +0.08
        y3 = +0.00
        x4 = +0.30
        y4 = +0.22

        self.quad(x1, y1, x2, y2, y2, x2, y1, x1)
        self.quad(x3, y3, x4, y4, y4, x4, y3, x3)

        self.extrude(x1, y1, x2, y2)
        self.extrude(x2, y2, y2, x2)
        self.extrude(y2, x2, y1, x1)
        self.extrude(y1, x1, x1, y1)
        self.extrude(x3, y3, x4, y4)
        self.extrude(x4, y4, y4, x4)
        self.extrude(y4, x4, y3, x3)

        Pi = 3.14159265358979323846
        NumSectors = 200

        for i in range(NumSectors):
            angle1 = (i * 2 * Pi) / NumSectors
            x5 = 0.30 * math.sin(angle1)
            y5 = 0.30 * math.cos(angle1)
            x6 = 0.20 * math.sin(angle1)
            y6 = 0.20 * math.cos(angle1)

            angle2 = ((i + 1) * 2 * Pi) / NumSectors
            x7 = 0.20 * math.sin(angle2)
            y7 = 0.20 * math.cos(angle2)
            x8 = 0.30 * math.sin(angle2)
            y8 = 0.30 * math.cos(angle2)

            self.quad(x5, y5, x6, y6, x7, y7, x8, y8)

            self.extrude(x6, y6, x7, y7)
            self.extrude(x8, y8, x5, y5)

        GL.glEnd()
        GL.glEndList()

        return genList

    def quad(self, x1, y1, x2, y2, x3, y3, x4, y4):
        self.qglColor(self.trolltechGreen)

        GL.glVertex3d(x1, y1, -0.05)
        GL.glVertex3d(x2, y2, -0.05)
        GL.glVertex3d(x3, y3, -0.05)
        GL.glVertex3d(x4, y4, -0.05)

        GL.glVertex3d(x4, y4, +0.05)
        GL.glVertex3d(x3, y3, +0.05)
        GL.glVertex3d(x2, y2, +0.05)
        GL.glVertex3d(x1, y1, +0.05)

    def extrude(self, x1, y1, x2, y2):
        self.qglColor(self.trolltechGreen.dark(250 + int(100 * x1)))

        GL.glVertex3d(x1, y1, +0.05)
        GL.glVertex3d(x2, y2, +0.05)
        GL.glVertex3d(x2, y2, -0.05)
        GL.glVertex3d(x1, y1, -0.05)

    def normalizeAngle(self, angle):
        while angle < 0:
            angle += 360 * 16
        while angle > 360 * 16:
            angle -= 360 * 16
        return angle

    
#--------------------------------------    

if __name__ == '__main__':

    Log_String( "Hello_PyQtOpenGL.py -- LogFile ---------\n", InitFile=True )

#----
    
    app = QtGui.QApplication(sys.argv)
    window = Window()
    window.show()

    raw_input( "Type [Enter] to exit program" )

    window.close()      # Add by PL, missing in original PyQt example program

#----
    
    Log_String( "Hello_PyQtOpenGL.py -- End of LogFile --\n" )
   
#   sys.exit(app.exec_())   

print 
print "--- Hello_PyQtOpenGL_PL.py --- Done ------------------------------"
    



_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic