好的-它起作用了。在
我在这里使用了参考文献1:import sys,os
import pygtk, gtk, gobject
class GTK_Main:
def __init__(self):
""" Design!!! """
button_rc = """
pixmap_path "/var/tmp"
style "default-style" {
GtkVScale::slider_length = 14
GtkVScale::slider_width = 15
GtkVScale::focus-padding = 4
GtkVScale::trough-side-details = 0
GtkVScale::trough-border = 1
GtkVScale::value-spacing = 0
GtkVScale::trough-under-steppers = 0
GtkVScale::arrow-displacement-x = 7
GtkVScale::arrow-displacement-y = 0
GtkVScale::activate_slider = 0
xthickness = 1
ythickness = 1
#bg[NORMAL] = "#f6f6f6"
fg[NORMAL] = "#000000"
}
class "GtkWidget" style "default-style"
style "deButton" {
fg[PRELIGHT] = { 0, 1.0, 1.0 }
bg[PRELIGHT] = { 0, 0, 1.0 }
bg[ACTIVE] = { 1.0, 0, 0 }
fg[ACTIVE] = { 0, 1.0, 0 }
bg[NORMAL] = { 1.0, 1.0, 0 }
fg[NORMAL] = { .99, 0, .99 }
bg[INSENSITIVE] = { 1.0, 1.0, 1.0 }
fg[INSENSITIVE] = { 1.0, 0, 1.0 }
engine "pixmap" {
image {
function = SLIDER
orientation = VERTICAL
file = "a.png"
stretch = TRUE
}
image {
function = BOX
orientation = VERTICAL
file = "b.gif"
border = { 0, 0, 32, 32}
stretch = TRUE
}
}
bg_pixmap[NORMAL] = "b.gif"
}
widget "*.deButton" style "deButton"
"""
window = gtk.Window(gtk.WINDOW_TOPLEVEL)
window.set_title("Test")
window.set_default_size(500, 400)
window.connect("destroy", gtk.main_quit, "WM destroy")
gtk.rc_parse_string(button_rc) # 2
hbox_eq = gtk.HBox()
hbox_eq.set_size_request(200, 150)
self.hscale_one = gtk.VScale()# gtk.HScale()
self.hscale_one.set_range(-24, 12)
self.hscale_one.set_name("deButton") # 3
hbox_eq.pack_start(self.hscale_one, True, True, 0)
self.hscale_two = gtk.VScale()# gtk.HScale()
self.hscale_two.set_range(-24, 12)
hbox_eq.pack_start(self.hscale_two, True, True, 0)
vbox = gtk.VBox()
vbox.pack_start(hbox_eq, False)
window.add(vbox)
window.show_all()
def exit(self, widget, data=None):
gtk.main_quit()
GTK_Main()
gtk.gdk.threads_init()
gtk.main()