Results 1 to 1 of 1

Thread: set color table in PyQt4

  1. #1
    Join Date
    Apr 2008
    Location
    China
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default set color table in PyQt4

    Hello,
    I'm a newbie. How to set the color table of a image? My script is:
    Qt Code:
    1. #coding = utf-8
    2. # file_name = test2.py
    3.  
    4. from PyQt4 import QtCore, QtGui
    5.  
    6. im = QtGui.QImage(10, 10, QtGui.QImage.Format_Indexed8)
    7.  
    8. im.setColorTable([QtCore.Qt.black, QtCore.Qt.white, QtCore.Qt.red])
    9.  
    10. im.setPixel(1, 2, 0)
    11. im.setPixel(2, 1, 1)
    12. im.setPixel(0, 2, 2)
    13.  
    14. im.save('/home/grissiom/im.png')
    To copy to clipboard, switch view to plain text mode 
    but the image is totally black. How could I fix it? Thanks in advance ;)
    Last edited by grissiom; 6th April 2008 at 15:52.

Similar Threads

  1. keypressevent with pyqt4
    By coldlin in forum Qt Programming
    Replies: 3
    Last Post: 3rd October 2007, 17:52
  2. PyQt4 to Py3exe problem
    By WinchellChung in forum Newbie
    Replies: 3
    Last Post: 9th August 2007, 20:33

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.