This wiki is in the process of being archived due to lack of usage and the resources necessary to serve it — predominately to bots, crawlers, and LLM companies. Edits are discouraged.
Pages are preserved as they were at the time of archival. For current information, please visit python.org.
If a change to this archive is absolutely needed, requests can be made via the infrastructure@python.org mailing list.

Animated items using delegates

A nasty hack involving a custom delegate, timer events and a signal to inform a view that it needs to repaint itself. It is just a proof of concept.

Perhaps a better example might be Animated items using delegates and movies.

Things that are wrong with this code:

   1 import sys
   2 from PyQt4.QtCore import pyqtSignal, Qt, QVariant
   3 from PyQt4.QtGui import *
   4 
   5 # Icons used for animation:
   6 _icon0_xpm = [
   7     "16 16 4 1",
   8     ".  c None",
   9     "s  c #cccc00",
  10     "x  c #ffffff",
  11     "   c #000000",
  12     "................",
  13     ".              .",
  14     ". xxxxxxxxxxxx .",
  15     ". x          x .",
  16     ".. x ssssss x ..",
  17     "... x ssss x ...",
  18     ".... x ss x ....",
  19     "..... x  x .....",
  20     "..... x  x .....",
  21     ".... x    x ....",
  22     "... x      x ...",
  23     ".. x        x ..",
  24     ". x          x .",
  25     ". xxxxxxxxxxxx .",
  26     ".              .",
  27     "................"]
  28 
  29 _icon1_xpm = [
  30     "16 16 4 1",
  31     ".  c None",
  32     "s  c #cccc00",
  33     "x  c #ffffff",
  34     "   c #000000",
  35     "................",
  36     ".              .",
  37     ". xxxxxxxxxxxx .",
  38     ". x          x .",
  39     ".. x s    s x ..",
  40     "... x ssss x ...",
  41     ".... x ss x ....",
  42     "..... x  x .....",
  43