Problems about my newbie code.( using pygtk )

asho asho at nospam.com
Mon Jan 20 11:34:02 CET 2003


hi...
I started to use the gtk with python to write some gui programs.


my goal is to make a program window with two buttons.

Codes are listed below

#!/usr/bin/env python

# this is a translation of "Hello World III" from the GTK manual,
# using gtk.py

from gtk import *
import os

def vcdrip(*args):
        #command = "vcdxrip --cdrom-device=/dev/cdrom -p"
        command = "hehe"
        os.system(command)
        window.destroy()

def destroy(*args):
    window.hide()
    mainquit()

window = GtkWindow(WINDOW_TOPLEVEL)
window.connect("destroy", destroy)
window.set_border_width(50)

button = GtkButton("vcdrip")
button.connect("clicked",vcdrip)
window.add(button)
button.show()

button2 = GtkButton("exit")
button2.connect("clicked",destroy)
window.add(button2)
button2.show()

window.show_all()

mainloop()

When I run this program , it only appears a button with vcdrip.

Is there anything wrong with my ocde?? Please help me to solve the problem.

Thanks





More information about the Python-list mailing list