File indexing completed on 2024-12-22 04:17:10
0001 #!/usr/bin/python 0002 0003 # pressing a button makes random circles appear. 0004 0005 import sip 0006 sip.setapi('QString', 1) 0007 import pykst as kst 0008 import sys 0009 import random 0010 from PyQt4 import QtCore, QtNetwork, QtGui 0011 0012 class Magic: 0013 def __init__(self,client): 0014 self.client=client 0015 def test(self): 0016 self.client=client 0017 random.seed() 0018 client.new_circle((random.random(),random.random()), random.random()/10.0, 0019 "#"+str(random.randint(0,9))+str(random.randint(0,9))+str(random.randint(0,9))) 0020 0021 client=kst.Client("testbutton") 0022 app=QtGui.QApplication(sys.argv) 0023 m=Magic(client) 0024 0025 s=QtNetwork.QLocalSocket() 0026 s.readyRead.connect(m.test) 0027 b=kst.Button(client,"Click Here",s,0.5,0.5,0.2,0.1) 0028 app.exec_()