User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Python section within the Software Development category of DaniWeb, a massive community of 456,564 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,560 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Python advertiser: Programming Forums
Views: 999 | Replies: 0
Reply
Join Date: Oct 2007
Location: Pennsylvania, US
Posts: 37
Reputation: maddog39 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 3
maddog39 maddog39 is offline Offline
Light Poster

PyGTK: issue packing widgets into dialog

  #1  
Oct 24th, 2007
Hello all,

I've been having a ton of trouble with this custom gtk dialog I am trying to create. The code "runs" however I receive a GtkWarning message saying:
/home/maddog39/Projects/mmoalert/actiondialog.py:42: GtkWarning: gtk_box_pack_end: assertion `child->parent == NULL' failed
  self.message_hbox.pack_end(self.message_entry)
For the life of me, I can't seem to figure out what going on and why this is happening. As usual, its probably something very simple that keeps passing by me. Heres the code for the dialog.
  1. import gtk, utils
  2.  
  3. ACTIONDIALOG_TYPE_ADD = 0
  4. ACTIONDIALOG_TYPE_EDIT = 1
  5.  
  6. class ActionDialog(gtk.Dialog):
  7. def __init__(self, type, app, title=None, content=None):
  8. gtk.Dialog.__init__(self, None, None, gtk.DIALOG_MODAL)
  9.  
  10. if type == ACTIONDIALOG_TYPE_ADD:
  11. self.set_title("Add New Article")
  12. else:
  13. self.set_title("Edit Article")
  14.  
  15. # Setup dialog widgets
  16. self.title_label = gtk.Label("Title")
  17. self.title_entry = gtk.Entry(max=180)
  18. self.message_label= gtk.Label("Message")
  19. self.message_entry = utils.TextField()
  20. self.message_entry.set_wrap_mode(gtk.WRAP_WORD)
  21.  
  22. # Fill fields with data if in edit mode
  23. if title != None and content != None:
  24. self.title_entry.set_text(title)
  25. self.message_entry.set_text(content)
  26.  
  27. # Create boxes to hold widgets
  28. self.title_hbox = gtk.HBox()
  29. self.title_hbox.pack_start(self.title_label)
  30. self.title_hbox.pack_end(self.title_entry)
  31. self.message_hbox = gtk.HBox()
  32. self.message_hbox.pack_start(self.message_label)
  33. self.message_hbox.pack_end(self.message_entry)
  34. # DEBUG: not working properly
  35. # Pack Widgets into vertical box
  36. self.vbox.pack_start(self.title_hbox)
  37. self.vbox.pack_start(self.message_hbox)
  38.  
  39. # Add the buttons to the dialog
  40. self.add_button(gtk.STOCK_SAVE, gtk.RESPONSE_ACCEPT)
  41. self.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT)
Help much appreciated.

Thanks!
-Alec Hussey (maddog39)
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Python Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Python Forum

All times are GMT -4. The time now is 5:47 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC