Python
  Home arrow Python arrow Page 2 - PyQT: Input Widgets
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
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? 
Google.com  
PYTHON

PyQT: Input Widgets
By: A.P.Rajshekhar
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 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:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log 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 - QCheckBox
    ( Page 2 of 5 )

    This widget provides the checkbox with text. It can have three states – checked, unchecked and no change of state. In essence it is an option button that can be turned on or off. In an application checkbox it can come handy when a set of options have to be presented to the user and user has the choice of selecting one or more options.

    Typically checkboxes are used when their state doesn’t effect the states of other widgets. However there are exceptions to this rule as we will see in the example. The main aspect of QCheckBox is that just like QButton, it also has been derived from QAbstractButton and doesn’t have any slots. However, the methods provide all the required services. Secondly, a group of logically similar checkboxes can be grouped visually into a category using the QButtonGroup. The main signal of QCheckbox is stateChange(), and its main methods are checkStateSet() and setText(). The second method is inherited. 

    The stateChange() signal is used whenever the user checks or unchecks the widget. In other words, when the state of the widget changes, the widget emits a stateChange signal. The argument contains the check box’s new Toggle state. The Toggle state is an integer that contains current state.

    The checkStateSet() method takes Qt.CheckState as argument. The valid values are Qt.Unchecked, Qt.PartiallyChecked and Qt.Checked. The second value comes into the picture when items in hierarchical models may be partially checked if some, but not all, of their children are checked.

    The setText() method can be used to set the text of a checkbox. The parameter passed is QString, representing the text to be set. However, it doesn’t cause any signals to be emitted. Using the setIcon method, an icon can be placed beside the checkbox.

    To create a checkbox with the text "secure," the code would be:

    cb12=QCheckBox("&Secure”)
    cb12.setTristate(TRUE)

    That brings us to the end of this section. In the next section I would be designing a form that would provide minimal connection details to connect to a server.



     
     
    >>> More Python Articles          >>> More By A.P.Rajshekhar
     

       

    PYTHON ARTICLES

    - Tuples and Other Python Object Types
    - The Dictionary Python Object Type
    - String and List Python Object Types
    - Introducing Python Object Types
    - Mobile Programming using PyS60: Advanced UI ...
    - Nested Functions in Python
    - Python Parameters, Functions and Arguments
    - Python Statements and Functions
    - Statements and Iterators in Python
    - Sequences and Sets in Python
    - Python Expressions and Operators
    - Dictionaries, Variables and Statements in Py...
    - Data Types in Python
    - The Python Language
    - SSH with Twisted





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek