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 8473313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:18:57+00:00 2026-06-10T17:18:57+00:00

I would like to subclass an existing Gtk widget and get it to work

  • 0

I would like to subclass an existing Gtk widget and get it to work with Glade3. The code is all python, and I’m using PyGObject.

What I want to do is extend Gtk.TextView and be able to add it to my glade UI as if it were a native widget.

I read that it was possible with Glade 2, but I’m not sure how to do this with Glade 3, and I can’t seem to find any examples or documentation on this. Any help would be appreciated. Thanks.

  • 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-10T17:18:58+00:00Added an answer on June 10, 2026 at 5:18 pm

    Finally found out how to do it. First, you have to declare that your glade file depends upon a catalog.

    <?xml version="1.0" encoding="UTF-8"?>
    <interface>
      <!-- interface-requires gtk+ 3.0 -->
      <!-- interface-requires the_catalog_name 1.0 -->
      ...Rest of the glade file...
    

    Next, create a catalog.xml file. To extend a treeview, it should look something like this:

    <glade-catalog name="the_catalog_name" domain="glade-3" 
                   depends="gtk+" version="1.0">
      <glade-widget-classes>
        <glade-widget-class title="My Custom Text View" name="CustomTextView" 
                            generic-name="CustomTextView" parent="GtkTextView"
                            icon-name="widget-gtk-textview"/>
      </glade-widget-classes>
    </glade-catalog>
    

    And that’s it. Obviously There’s no python code written yet, but that won’t prevent Glade from displaying your custom widget. It will just treat it as a normal TextView, Label, or whatever else you want to extend.

    Oh, and I couldn’t find a way in Glade itself to create a CustomTextView unfortunately. But what you can do is add a regular TextView in glade, save the glade file and open it in a text editor. Just look for the treeview you created and change like so:

    -              <object class="TreeView" id="treeview1">
    +              <object class="CustomTreeView" id="treeview1">
    

    Open it back up in glade and it shows up. Then just define a CustomTreeView class in python and extend as needed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to create a subclass of python's unittest.Testcase called BasicTest. I would
I would like to subclass the UINavigationController to get some more freedom in regards
How can I code a custom init for NSManagedObject subclass? I would like something
I would like to ask for an advice regarding xts subclass. I am using
I would like to access my subclass using only the name of my module.
Would like to know the c# code to actually retrieve the IP type: Static
I would like to add a GestureDetector to all views (view groups) of an
I am looking to create a Custom UIButton (not subclass) progrmatically, I would like
I would like to create a junit test suite using JUnit 4 where the
I have a UIImagePickerController subclass, and I would like to detect when the user

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.