python - PyQt4 Custom dialog not showing -


I am working with PyQt4 to create a simple Python GUI app.

The situation is low:

I have a QMainWindow displaying a custom widget and it displays a curved content with custom widgets:

List> Tag: Category: ListTagWidget (QWidget): def __init __ (self, original = none): super (listguagwd, self) .__ init (__) addButton = "QPushButton" ("add more tags ...") EditButton = QPushButton ("and edit the tag ...") removeButton = QPushButton ("and delete the tag") self.taglist = QListWidget () layout = QGridLayout (self) layout.addWidget (self.taglist, 1, 1, 1 , 1) layout.addWidget (addButton, 2, 1) layout.addWidget (editButton, 3, 1) layout.addWidget (Remove button, 4, 1) Self. Settleouts (layout) self.adjustSize () # Connect the connection automatically (add button, signal ("clicked"), Self.addTag def AddTag (self): dialog = AddTagDlg (self) dialog.show ()

I want to display this custom dialog class basically when addButton is clicked:

addtagDlg (QDialog): def __init __ (self, generator = none): super (AddTagDlg, self) .__ init (__) buttonbox = QDialogButtonBox (QDialogButtonBox.Ok | QDialogButtonBox.Cancel) label = QLabel ("Tag Name:") Line Edit = QLineEdit () Layout = QGridLayout () layout.addWidget (label, 1, 1) layout.addWidget (line editing, 1, 2) layout.addWidget Box, 2, 1) self.setLayout (layout) self.setWindowTitle ("Add tag ...")

But this does not work, I do not use the addTag method to change it to a dialog inline Is able to create:

  def addTag (self): dialog = QDialog () dialog.show ()  

But I am satisfied with inline communication creation I'm not. What's my error Thank you.

Edit

The problem was with the creator of the custom dialogue class:

  class AddTagDlg (QDialog): Def __init __ (self, parent = none): super (AddTagDlg, self) .__ init __ (parent) # & lt; - Lost button box = QDialogButtonBox (QDialogButtonBox.Ok | QDialogButtonBox.Cancel) ...  

< Try calling call exec_ () on p> dialog, this should show you the dialog.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -