def test():
    from qt import QWidget
    class W(QWidget):
        def __init__(self):

            QWidget.__init__(self)
    
    def create():
        global _list
        s = SampleControl()
        s.load('/home/ajole/wav/trance.wav')
        s.slotStart()
        s.slotSetZone(0, True)
        _list.append(s)
    
    import pkaudio
    from qt import QApplication, QPushButton, QObject, SIGNAL
    pkaudio.connect_to_host(startserver=0)
    a = QApplication([])

    w1 = SampleControl()
    w1.load('/home/ajole/wav/track.wav')
    w1.slotStart()
    w1.slotSetZone(0, True)

    b = QPushButton('create', None)
    QObject.connect(b,
                    SIGNAL('clicked()'),
                    create)
    b.show()
    a.setMainWidget(b)
    a.exec_loop()
 def SimpleButton(parent, title, handler, page=None, image=None):
     tabpage = parent.getPage(page)
     button = QPushButton(tabpage)
     if image:
         bi = QPixmap()
         bi.loadFromData(image, "PNG")
         button.setIconSet(QIconSet(bi))
         w = bi.width() + 3
         h = bi.height() + 3
         if w < 32:
             w = 32
         if h < 32:
             h = 32
         button.setMaximumSize(QSize(w, h))
     else:
         button.setText(title)
     QToolTip.add(button, title)
     parent.connect(button, SIGNAL("clicked()"), handler)
     button.show()
     p = ToolbarPlugin(parent)
     p.getWidget = lambda: button
 def SimpleButton(parent, title, handler, page=None, image=None):
     tabpage = parent.getPage(page)
     button = QPushButton(tabpage)
     if image : 
         bi = QPixmap()
         bi.loadFromData(image, "PNG")
         button.setIconSet(QIconSet(bi))
         w = bi.width()+3
         h = bi.height()+3
         if w < 32:
             w = 32
         if h < 32:
             h = 32
         button.setMaximumSize(QSize(w, h))
     else:
         button.setText(title)
     QToolTip.add(button, title)
     parent.connect(button, SIGNAL("clicked()"), handler)
     button.show()
     p = ToolbarPlugin(parent)
     p.getWidget = lambda: button
Beispiel #4
0
import sys
from qt import QApplication, QPushButton

app=QApplication(sys.argv)
button=QPushButton(None)
button.setText("Hello World")
app.setMainWidget(button)
button.show()
app.exec_loop()