[PyQt] Help with Design of Dialog interface

David Boddie david at boddie.org.uk
Tue Apr 19 00:07:12 BST 2011


On Sun, 17 Apr 2011 19:43:17 +0100, alsaf wrote:

> I am currently writing a project which takes vocabulary words from a XML
> file which is created through the KDE application Parley and generates
> sentences based on them. The project page is here:
>
> https://sourceforge.net/projects/languagesentenc/

[...]

> The part I am stuck at is the maintenance of the sentence templates.
> This part of the GUI will extract all the word types from the XML file
> which will used to validate the input the user enters when creating the
> sentence template.  The only way I think I can do this is to create a
> widget that contains a drop down list and a button. The user selects the
> word type from the list and when the button is pressed the contents of
> the drop down list is then appended to the sentence template. This
> sounds a bit clunky and cumbersome to do. Is there any easier way like a
> line edit button which has an auto-complete option or some other method
> is input that I can use?

There is a recipe for an auto-completing line edit in the Wiki:

  http://www.diotavelli.net/PyQtWiki/Adding_auto-completion_to_a_QLineEdit

Another possibility is to present a menu when the user presses a certain
key. The following recipe uses the Tab key for this:

  http://www.diotavelli.net/PyQtWiki/Adding_tab-completion_to_a_QLineEdit

As the page says, it would probably be best to use a QCompleter instead of
a list, so perhaps you could try taking the best parts from each of these
examples.

David


More information about the PyQt mailing list