[PyQt] Composite widgets?
Peter Milliken
peter.milliken at gmail.com
Mon Sep 6 11:18:48 BST 2010
Thanks Dan, but I was really looking for something much more elaborate :-)
The structure of the Pmw library/widgets is difficult to describe, but I
found it an amazingly powerful library that allow some pretty nice (and
easy) extensions once you understood how it worked. Whilst I have never
delved into the inner workings, I might try some form of a basic port of the
code to PyQt (assuming there is nothing else available) - I'll have to look
into it, because I suspect it might be a pretty big job! It will certainly
stretch my knowledge of Python! :-)
Thanks anyway,
Peter
On Mon, Sep 6, 2010 at 5:16 PM, Dan Kripac <dankripac at gmail.com> wrote:
> Hi Peter,
>
> I find that a lot of my use with PyQt is composing compound widget
> subclasses that combine other widgets in a particular arrangement and
> behaviour that I need. You can easily design the way they behave in terms of
> signals emitted, and you can capture mouse and keyboard events simply by
> overriding particular methods from the base QWidget class.
>
> Not sure if there are many pre-existing libraries of these (that I know).
> Perhaps because it's easy to do once you get the hang of it. For example, to
> make a combined label and line edit:
>
> class myTextField(QWidget):
> def __init__(self,label="My Text Field", parent=None):
> super(myTextField,self).__init__(parent)
> layout = QHBoxLayout()
> self.label = QLabel(label)
> layout.addWidget( self.label )
> self.lineEdit = QLineEdit()
> layout.addWidget( self.lineEdit )
> self.setLayout( layout )
>
> You can get much more sophisticated than this, but just a quick example
> really.
>
> Hope this helps.
>
> Dan
>
> On 6 September 2010 02:13, Peter Milliken <peter.milliken at gmail.com>wrote:
>
>> Prior to embarking on learning PyQt, I wrote my GUI applications using
>> Tkinter and Pmw. The Pmw widget set is quite nice and provides a library of
>> composite classes using the Tkinter widgets.
>>
>> My question is:
>>
>> Is there any (similar) composite widgets in PyQt? i.e. Pmw has the
>> EntryField widget, which combines the (commonly used case) of a Label and a
>> LineEdit into the one class - much more convenient than always having to
>> specify the two entities separately, which seems to be the case with PyQt?
>> The EntryField widget offers far more than just conveniently creating a
>> Label and a LineEdit in the one class, it also allows definition of entry
>> validation as well, so you can see that the composite classes provide quite
>> a high level of functional behaviour to the user.
>>
>> Pmw defines other composite widgets like: RadioSelect - which groups radio
>> buttons (well, you have the choice of defining it to handle radio buttons,
>> check buttons or "normal" buttons). Of course in PyQt I have found the
>> QGroupBox class, but this only performs a (small) part of what the Pmw
>> RadioSelect widget does.
>>
>> Do such composite widgets exist? am I missing something in the PyQt
>> documentation?
>>
>> Thanks
>> Peter
>>
>>
>> _______________________________________________
>> PyQt mailing list PyQt at riverbankcomputing.com
>> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100906/28820a0a/attachment.html>
More information about the PyQt
mailing list