Python
  Home arrow Python arrow Page 5 - PyQT: Input Widgets
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Moblin 
JMSL Numerical Library 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PYTHON

PyQT: Input Widgets
By: A.P.Rajshekhar
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 4
    2006-11-20

    Table of Contents:
  • PyQT: Input Widgets
  • QCheckBox
  • PyQT in the Real World
  • The Connections
  • The Main Part

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    PyQT: Input Widgets - The Main Part


    (Page 5 of 5 )

    Lastly, here is the "main" part of the application:

    class Form1(QDialog):

        def __init__(self,parent = None,name = None,modal = 0,fl =
    0):

            QDialog.__init__(self,parent,name,modal,fl)

            if not name:

                self.setName("Form1")

            self.textLabel1 = QLabel(self,"textLabel1")

            self.textLabel1.setGeometry(QRect(30,71,111,30))

            self.textLabel1_2 = QLabel(self,"textLabel1_2")

            self.textLabel1_2.setGeometry(QRect(30,140,111,30))

           

            self.lineEdit1 = QLineEdit(self,"lineEdit1")

            self.lineEdit1.setGeometry(QRect(160,70,181,31))

            self.lineEdit2 = QLineEdit(self,"lineEdit2")

            self.lineEdit2.setGeometry(QRect(161,140,180,31))

           self.checkBox1 = QCheckBox(self,"checkBox1")

            self.checkBox1.setGeometry(QRect(30,190,91,21))

            self.pushButton1 = QPushButton(self,"pushButton1")

            self.pushButton1.setEnabled(1)

            self.pushButton1.setGeometry(QRect(30,230,141,21))

            self.pushButton1_2 = QPushButton(self,"pushButton1_2")

            self.pushButton1_2.setEnabled(1)

            self.pushButton1_2.setGeometry(QRect(210,230,141,21))

            self.languageChange()

            self.resize(QSize(600,480).expandedTo
    (self.minimumSizeHint()))

            self.clearWState(Qt.WState_Polished)

            self.connect(self.lineEdit1,SIGNAL("returnPressed
    ()"),self.lineEdit2.selectAll)

            self.connect(self.pushButton1_2,SIGNAL("clicked
    ()"),self.lineEdit1.clear)

            self.connect(self.pushButton1_2,SIGNAL("clicked
    ()"),self.lineEdit2.clear)

        def languageChange(self):

            self.setCaption(self.__tr("Form1"))

            self.textLabel1.setText(self.__tr("Host"))

            self.textLabel1_2.setText(self.__tr("Port"))

            self.pushButton1.setText(self.__tr("Submit"))

            self.pushButton1_2.setText(self.__tr("Reset"))

            self.checkBox1.setText(self.__tr("Secured"))

            self.lineEdit1.setText(self.__tr("192.168.1.1"))

            self.lineEdit2.setText(self.__tr("3306"))

        def __tr(self,s,c = None):

            return qApp.translate("Form1",s,c)

     if __name__ == "__main__":

        a = QApplication(sys.argv)

        QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT
    ("quit()"))

        w = Form1()

        a.setMainWidget(w)

        a.exec_loop()

    That brings us to the end of this discussion. There are certain concepts such as translation and labels that have been used in the example but not explained. Those will be the topics of future discussions along with the remaining input widgets. Till then…


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · In this article I have discussed about using textbox and checkbox for input...
       · It's the main pyqt version now, and the recommended one for beginners, that are are...
       · First let me thank you for your encouragement and appreciation. As for why not PyQT...
     

       

    PYTHON ARTICLES

    - SSH with Twisted
    - Mobile Programming in Python using PyS60: UI...
    - Python: Count on It
    - Python Strings: Spinning Yarns
    - Python: More Fun with Strings
    - Python: Stringing You Along
    - Python Operators
    - Bluetooth Programming in Python: Network Pro...
    - Python Sets
    - Python Conditionals, Lists, Dictionaries, an...
    - Python: Input and Variables
    - Introduction to Python Programming
    - Mobile Programming in Python using PyS60: Ge...
    - Bluetooth Programming using Python
    - Finishing the PyMailGUI Client: User Help To...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway