【python】pyqt练习

import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import ui_price

class PriceDlg(QDialog,ui_price.Ui_Dialog):
    def __init__(self,parent=None):
        super(PriceDlg,self).__init__(parent)
        
        self.setupUi(self)
        #self.whenTimeEdit.timeChanged

        self.okPushButton.setHidden(1)
    
    def on_custmorLineEdit_textChanged(self):
        self.okPushButton.setHidden(0)
        #self.okPushButton.setEnabled(enable)
            
            
    @pyqtSignature('')
    def on_okPushButton_clicked(self):
        self.setamount(self.getprice()*self.getquan())
        
    @pyqtSignature('')
    def on_whenTimeEdit_timeChanged(self):
        self.setamount(self.getprice()*self.getquan())
        
    def setamount(self,amount):
        self.amountLineEdit.setText(str(amount))
        
    def getprice(self):
        return float(self.priceSpinBox.text())
        
    def getquan(self):
        return float(self.QuanSpinBox.text())
    
    
app=QApplication(sys.argv)
form=PriceDlg()
form.show()
app.exec_()

        
       
        

 

posted on 2013-10-01 12:10  colipso  阅读(458)  评论(0编辑  收藏  举报

导航