Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have created a window using quickly add dialog. But I can't figure out how to simply open the dialog from a button. I have already set up a button in my main window and set up the code for it. This is the code for the button:

def on_quicksitesbutton_clicked(self, widget):
dialog = QuicksitesDialog.QuicksitesDialog()
result =

I also imported the dialog with this line of code:

from brandsonicweb.QuicksitesDialog import QuicksitesDialog

The program runs fine, but when I click the button I get in the terminal:

Traceback (most recent call last):
  File "/home/brandon/brandsonicweb/brandsonicweb/", line 71, in on_quicksitesbutton_clicked
    dialog = QuicksitesDialog.QuicksitesDialog()
AttributeError: type object 'QuicksitesDialog' has no attribute 'QuicksitesDialog'

What am I doing wrong? How can I make this work?

share|improve this question

Probably this:

You import the QuicksitesDialog first:

from brandsonicweb.QuicksitesDialog import QuicksitesDialog

And then you try to call it again:

dialog = QuicksitesDialog.QuicksitesDialog()

Without looking at your code, this can be fixed in 2 ways:

from brandsonicweb.QuicksitesDialog import QuicksitesDialog
dialog = QuicksitesDialog()


from brandsonicweb import QuicksitesDialog
dialog = QuicksitesDialog.QuicksitesDialog()

It can be a bit confusing because apparently Quickly gives the module and class both the same name.

Also notice the excellent Python error which gives you a nice indication.

share|improve this answer
Does all this code go in the button? – Sega dude Jun 23 '13 at 14:14
@Segadude: This is just normal Python code, you did have read at least one tutorial, right? There's no rule, but imports should be on top of the file. Calling the dialog should ofcourse be in the button handler. – Timo Jun 23 '13 at 16:22
When I tried the second method, I get this error when I click the button Traceback (most recent call last): File "/home/brandon/brandsonicweb/brandsonicweb/", line 71, in on_quicksitesbutton_clicked dialog = QuicksitesDialog.QuicksitesDialog() File "/home/brandon/brandsonicweb/brandsonicweb/", line 25, in new new_object.finish_initializing(builder) AttributeError: 'NoneType' object has no attribute 'finish_initializing' Here are the relevant files: , – Sega dude Jun 23 '13 at 20:55
I never used Quickly, but my guess is that you don't have your dialog named quicksites_dialog in your Glade file. new_object = builder.get_object('quicksites_dialog') probably returns None if it can't find a widget with that name (hence the error 'NoneType' object has no attribute 'finish_initializing'). So either rename the dialog in Glade or in that line. – Timo Jun 24 '13 at 7:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.