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

  • SEARCH
  • Home
  • 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 6742923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:54:01+00:00 2026-05-26T11:54:01+00:00

i am trying to build a GUI using pygtk and glade on Windows. I

  • 0

i am trying to build a GUI using pygtk and glade on Windows. I am a noob at python GUI building so please excuse my noobness. I Looked up this tutorial and did exactly as it said. The only difference was that I am on Windows 7 Home Premium x64 .

I put a Label and a button in a window using glade as in the tutorial and then i got a libglade xml file. Then i typed the following code

import sys
import pygtk
import gtk
import gtk.glade

pygtk.require("2.0")

class HellowWorldGTK:

    def __init__(self):

        #Set the Glade file
        self.gladefile = "Hello_World.glade"  
        self.wTree = gtk.glade.XML(self.gladefile) 

        #Get the Main Window, and connect the "destroy" event
        self.window = self.wTree.get_widget("MainWindow")

        if (self.window):
            self.window.connect("destroy", gtk.main_quit)

if __name__ == "__main__":
    hwg = HellowWorldGTK()
    gtk.main()  

I put both the files in the same folder and then i run a python interpreter from the command line into the folder.Apparently The program runs but the thing is that i’m unable to get the interface all i get on the command line is that that the Program is running. I dont even get an error or something.Is it due to the fact that i’m on Windows?? I thought that GTK was cross-platform and the same code should run on windows as well as on Linux??

Also here is the .glade file generated by GLADE GUI designer

<?xml version="1.0" encoding="UTF-8"?>
<glade-interface>
  <!-- interface-requires gtk+ 2.24 -->
  <!-- interface-naming-policy project-wide -->
  <widget class="GtkWindow" id="Hello world!">
    <property name="can_focus">False</property>
    <property name="resizable">False</property>
    <child>
      <widget class="GtkVBox" id="vbox1">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <child>
          <widget class="GtkLabel" id="Click Here!">
            <property name="visible">True</property>
            <property name="can_focus">False</property>
            <property name="label" translatable="yes">label</property>
          </widget>
          <packing>
            <property name="expand">True</property>
            <property name="fill">True</property>
            <property name="position">0</property>
          </packing>
        </child>
        <child>
          <widget class="GtkButton" id="Please Click on the Button!">
            <property name="label" translatable="yes">button</property>
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="receives_default">True</property>
            <property name="use_action_appearance">False</property>
          </widget>
          <packing>
            <property name="expand">True</property>
            <property name="fill">True</property>
            <property name="position">1</property>
          </packing>
        </child>
      </widget>
    </child>
  </widget>
</glade-interface>
  • 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-05-26T11:54:01+00:00Added an answer on May 26, 2026 at 11:54 am
    self.window.show()
    

    At the end of __init__ should do it I think.

    EDIT AFTER COMMENT…

    self.window = self.wTree.get_widget("MainWindow")

    but there is no window called “MainWindow”, I think you’ve called your window “Hello world!”, try loading that instead (or renaming your window in glade).

    It may be a good idea to check that your window is actially found in the glade file as well.

    window_name="Hello World!"
    self.window = self.wTree.get_widget(window_name)
    if (self.window):
        self.window.connect("destroy", gtk.main_quit)
    else:
        raise Exception("I couldn't find the window called "+window_name+"!")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a simple hello-world executable python gui app in windows using
I'm trying to build a Python application using pyGTK, treads, and sockets. I'm having
I'm trying to build a calculator GUI using migLayout, but I'm not familiar with
I am using Python 3.1 by the way. I am trying to build a
Trying to build a GUI application in Java/Swing. I'm mainly used to painting GUIs
I'm trying to build a GUI window in my application. What I'm trying to
Im trying to build call to action button on my site using jQuery. I
I am a student programmer and I am using Qt to build a GUI
I am trying to build up a GUI interface similar to the figure. Basically,
I am trying to build a simple LAN chat in c# using WPF as

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.