[PyKDE] autoAdding buttons to a grid

John Ridley ojokimu at yahoo.co.uk
Wed May 18 23:42:15 BST 2005


--- Richard Smith wrote:
[snip]
> - User Select Dance.  Which then creates a toggle button for each if
> the Dance classes in the database.  There's probally 10 - 15 of
> these.
>  So a grid of around 4 by 4 buttons appears.
> - User toggles the Dances desired in this case just one. "Cha Cha".
> - User selects one of the filter buttons.  In this case we will
> choose speed. 
> A small listing of 7 speeds is then displayed. 

Okay so create a button-group for each of the sets of buttons you need.
Hide them all by calling their hide() methods. As each set of buttons
is needed, call its show() method (after re-positioning it if necessary
by calling its move() method). There should be no need to keep creating
and destroying widgets to achieve what you want.

Many of the gui elements you will be using inherit from QWidget (which
provides the three methods mentioned above). Its quite important to
familiarize yourself with Qt's documentation for this class:

http://doc.trolltech.com/3.3/qwidget.html

The documentation also contains lots of good tutorials and howtos. One
in particular which might help you is this:

http://doc.trolltech.com/3.3/layout.html

You might also want to visit the excellent Qt forum, which is possibly
more geared towards the sorts of questions you are asking. You can find
it here:

http://www.qtforum.org

HTH

John Ridley


	
	
		
___________________________________________________________ 
Yahoo! Messenger - want a free and easy way to contact your friends online? http://uk.messenger.yahoo.com




More information about the PyQt mailing list