Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8716207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:01:27+00:00 2026-06-13T06:01:27+00:00

Using Glade to quickly code up a simple GUI, and I’m trying to create

  • 0

Using Glade to quickly code up a simple GUI, and I’m trying to create a generic error dialog in which I can set a label’s text to whatever the error is. Pretty straightforward in typical GUI development (get the child form, set label’s caption attribute, etc.).

I can’t seem to figure out how to get control of that label in PyGTK/Glade though.

Here is the XML for my dialog…

<object class="GtkMessageDialog" id="dError">
    <property name="can_focus">False</property>
    <property name="border_width">5</property>
    <property name="type_hint">dialog</property>
    <property name="skip_taskbar_hint">True</property>
    <property name="message_type">error</property>
    <property name="buttons">close</property>
    <child internal-child="vbox">
      <object class="GtkVBox" id="dialog-vbox">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="spacing">2</property>
        <child internal-child="action_area">
          <object class="GtkHButtonBox" id="dialog-action_area">
            <property name="visible">True</property>
            <property name="can_focus">False</property>
            <property name="layout_style">end</property>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
          </object>
          <packing>
            <property name="expand">False</property>
            <property name="fill">True</property>
            <property name="pack_type">end</property>
            <property name="position">0</property>
          </packing>
        </child>
        <child>
          <object class="GtkLabel" id="lblError">
            <property name="visible">True</property>
            <property name="can_focus">False</property>
          </object>
          <packing>
            <property name="expand">True</property>
            <property name="fill">True</property>
            <property name="position">2</property>
          </packing>
        </child>
      </object>
    </child>
  </object>

And here is the associated Python code I’m trying, with 2 attempts. The first I was trying to set the text field of the Error dialog, and the second I’d added a label and tried to first get and set that.

dError = self.builder_.get_object("dError") # get dialog

# Attempt 1 - setting the text field of the error dialog
# dError.set_text("Attempt 1")  
    #-- AttributeError: 'gtk.MessageDialog' object has no attribute 'set_text'

# Attempt 2 -setting an added label
# dLbl = dError.get_object("lblError")
    #-- AttributeError: 'gtk.MessageDialog' object has no attribute 'get_object'
# dlbl.set_text("Attempt 2")  

dError.show()
return True
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T06:01:30+00:00Added an answer on June 13, 2026 at 6:01 am

    For the xml you supplied you can set the label’s text with

    dError.label.set_text("test")
    

    Your problem was that you were accessing the MessageDialog and not the label itself. The above is a short-cut, more generically you can access the label(s) (should be easy to trace how it works by comparing with your xml):

    vbox = dError.get_child()
    hbox, label1, hbuttonbox = vbox.get_children()
    label1.set_text("Test1")
    im, vbox2 = hbox.get_children()
    label2, label3 = vbox2.get_children()
    label2.set_text("Text2")
    label3.set_text("Text3") #This one is invisible as default
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a really simple GUI using GtkBuilder and glade. To
I'd like to design a GUI using Glade, and generate python code from it.
I am using pygtk with glade to make a simple program which (by now)
I am trying create alert dailog using glade,but its not working .am i doing
I'm using Python 2.7, PyGTK 2.24, and Glade 2.8.0. I'm trying to set an
I'm using Glade-3 for my GUI design, but I keep hitting this problem. I
I'm using Glade 3 to create a GtkBuilder file for a PyGTK app I'm
I am building an application which has GtkMenu widget. I am using Glade RAD
I'm writing a python application that has a glade gui. Using subprocess to execute
I have a glade GUI and i'm using dome gtk.MessageDialog widgets created with pygtk

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.