|
[code:1]
#!/usr/bin/python
import gtk
import os
class pypabout:
def destroy(self,widget,data=None):
gtk.main_quit()
def ok_clicked(self,widget,data=None):
self.window.destroy()
def __init__(self):
self.window=gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.set_title("about pypppoe")
self.window.set_border_width(10)
self.window.connect("destroy",self.destroy)
self.box=gtk.VBox(gtk.FALSE,0)
self.window.add(self.box)
self.button_ok=gtk.Button("ok")
self.button_ok.connect("clicked",self.ok_clicked)
self.label=gtk.Label("[email protected]")
self.box.pack_start(self.label,gtk.TRUE,gtk.TRUE,10)
self.box.pack_start(self.button_ok,gtk.TRUE,gtk.TRUE,10)
self.label.show()
self.button_ok.show()
self.box.show()
self.window.show()
def main(self):
gtk.main()
class pypppoe:
def destroy(self,widget,data=None):
gtk.main_quit()
def enable_clicked(self,widget,data=None):
os.system("adsl-start")
def disable_clicked(self,widget,data=None):
os.system("adsl-stop")
def about_clicked(self,widget,data=None):
about=pypabout()
about.main()
def __init__(self):
self.window=gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.set_title("pypppoe")
self.window.set_border_width(10)
self.window.connect("destroy",self.destroy)
self.box=gtk.HBox(gtk.FALSE,0)
self.window.add(self.box)
self.button_enable=gtk.Button("enable")
self.button_enable.connect("clicked",self.enable_clicked,None)
self.button_disable=gtk.Button("disable")
self.button_disable.connect("clicked",self.disable_clicked,None)
self.button_about=gtk.Button("about")
self.button_about.connect("clicked",self.about_clicked,None)
self.box.pack_start(self.button_enable,gtk.TRUE,gtk.TRUE,5)
self.box.pack_start(self.button_disable,gtk.TRUE,gtk.TRUE,5)
self.box.pack_start(self.button_about,gtk.TRUE,gtk.TRUE,5)
self.button_enable.show()
self.button_disable.show()
self.button_about.show()
self.box.show()
self.window.show()
def main(self):
gtk.main()
if __name__=="__main__":
pypp=pypppoe()
pypp.main()[/code:1] |
|