[PyKDE] Canvas problems

Mark Kimsal chugadie.geo at yahoo.com
Tue Dec 12 21:36:54 GMT 2000


Boudewijn Rempt wrote:

> Funny this... Can you run Eric? I remember Phil having changed it so
> it works on Windows. And I know for sure that my canvas code runs on
> Windows - checked it last Sunday. But that's a bit difficult to just
> try out. Can you send your complete code? I'd like to experiment with
> it.

Eric doesn't seem to run on windows, some sort of permission problem when i hit
the 'run' button.  Could be that I just don't know how to work it though.
Anyways, here is my code.

--==Canvasprob.py==--
import sys
from qt import *


class ScrollView(QCanvasView):
 def __init__(this,canvas,parent):
  QCanvasView.__init__(this,canvas,parent,'viewport')
  this.resize(parent.size())
  this.setHScrollBarMode(QCanvasView.AlwaysOff)
  this.setVScrollBarMode(QCanvasView.AlwaysOff)


class MainWindow(QWidget):

    def __init__(self,parent = None,name = None,fl = 0):
        QWidget.__init__(self,parent,name,fl)


        if name == None:
            self.setName('MainWindow')

        self.resize(623,54)
        grid = QGridLayout(self)
        grid.setSpacing(0)
        grid.setMargin(0)

        canvas = QCanvas (self,'canvas')
        canvas.setBackgroundColor(Qt.black)
        canvas.resize(self.size().width(),self.size().height())
        self.canvas = canvas
        viewport = ScrollView(canvas,self)
        self.viewport = viewport

        stext = QCanvasText('hello world',self.canvas)
        #stext = QCanvasSprite(QCanvasPixmapArray("qt.png"),self.canvas)
        stext.show()

        grid.addWidget(self.viewport,0,0)


if __name__ == '__main__':
    a = QApplication(sys.argv)
    w = MainWindow()

    a.setMainWidget(w)
    w.show()

    a.exec_loop()




--==Eric output==--
Traceback (most recent call last):
  File "lib/eric\DebugClient.py", line 344, in ?
    debugClient.interact()
  File "lib/eric\DebugClient.py", line 218, in interact
    self.eventLoop()
  File "lib/eric\DebugClient.py", line 235, in eventLoop
    self.readReady(sys.stdin.fileno())
  File "lib/eric\AsyncIO.py", line 220, in readReady
    self.emit(PYSIGNAL('lineReady'),(s,))
  File "lib/eric\DebugClient.py", line 121, in handleLine
    self.run('execfile("%s")' % (self.running),self.context)
  File "c:\dev\python\lib\bdb.py", line 346, in run
    exec cmd in globals, locals
  File "<string>", line 1, in ?
IOError: [Errno 13] Permission denied
QSocket::sn_read (unnamed): Close error






More information about the PyQt mailing list