Re: [PyQt] Composite widgets?
On Mon, Sep 6, 2010 at 10:15 PM, Hans-Peter Jansen wrote: > > Start browsing the Qt documentation. Yes, it's a bit arkward to ignore the > C++ decoration, but after getting used to, you start to enjoy to be able to > ignore all the C++ related complexities and regret all those poor C++ > hackers: hack, compile, link, crash, hack, compile, link, just for entering > the event loop two or three hundred microseconds earlier then us (on an > average system) when they finally fixed their self created headaches. ROFL... if this were comp.lang.python, this would be my QOTW nominee :-) ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Composite widgets?
On Monday 06 September 2010, 03:13:29 Peter Milliken 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. Well, the powers of Pmw are undoubted, as long as you keep on the well prepared route. The reason, why Qt and therefore PyQt doesn't follow this route is flexibility. E.g. a label/editfield composite: usually you want the labels and editfields align to some grid, where they all align vertically, otherwise the UI looks pretty crowded. Given, I need more editors, e.g. a date and a combo for a single item, I tend to combine them ad hoc by a hbox layout from within designer instead of creating some composite widgets. > 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. All these exist as single items, just add them to your UI interactively in designer, but there's no such thing in Pmw. In a very old project, where I used Pmw until lately for historical reasons, I suffered from crashes in newer versions of tix, that where related to unicode issues of edit widgets. Such problems can drive you crazy, since looking into tix might damage one's brain. Try to create a table like window and different editors for all columns and say 10 rows with Pmw. Let it update hundreds of cells every second. Will it still be usable? I replaced that Pmw database frontend with a PyQt based one, where I halved the number of lines, but _added_ a bulk of functionality, that simply wouldn't been able with Pmw. Needless to say, it starts ten times quicker, it has a quick full text search facility in _huge_ tables at nearly zero cost, a table query tool, that creates persistent queries by dynamically creating the widgets (field, operation, argument, join) in a dummy prove way (this is an application where custom widgets make sense), print the tables nicely, the app looks good and the usability improved greatly. > Do such composite widgets exist? am I missing something in the PyQt > documentation? Start browsing the Qt documentation. Yes, it's a bit arkward to ignore the C++ decoration, but after getting used to, you start to enjoy to be able to ignore all the C++ related complexities and regret all those poor C++ hackers: hack, compile, link, crash, hack, compile, link, just for entering the event loop two or three hundred microseconds earlier then us (on an average system) when they finally fixed their self created headaches. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Composite widgets?
On having a quick look at pmw, I can definitely say that a lot of that functionality is available as PyQt native widgets (plus much much more) and the few exceptions would be able to be made with code not much more complex than the example I gave. It may seem overwhelming at first, but it would be a good way to learn PyQt and python as well I reckon ;-) Cheers Dan On 6 September 2010 11:18, Peter Milliken wrote: > 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 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 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 listPyQt@riverbankcomputing.com >>> http://www.riverbankcomputing.com/mailman/listinfo/pyqt >>> >> >> > ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Composite widgets?
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 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 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 listPyQt@riverbankcomputing.com >> http://www.riverbankcomputing.com/mailman/listinfo/pyqt >> > > ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Composite widgets?
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 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 listPyQt@riverbankcomputing.com > http://www.riverbankcomputing.com/mailman/listinfo/pyqt > ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Composite widgets?
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 listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt