Skip to content

Instantly share code, notes, and snippets.

@husio
Created December 12, 2009 10:00
Show Gist options
  • Save husio/254833 to your computer and use it in GitHub Desktop.
Save husio/254833 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import gtk
def sig_suspend(button, *args, **kwds):
gtk.main_quit()
os.system('pm-suspend')
def sig_poweroff(button, *args, **kwds):
gtk.main_quit()
os.system('sudo poweroff')
def sig_close(button, *args, **kwds):
gtk.main_quit()
def main():
window = gtk.Dialog()
window.set_position(gtk.WIN_POS_CENTER)
b_close = window.add_button('Abort', 2)
b_close.connect('clicked', sig_close)
b_poweroff = window.add_button('Suspend', 11)
b_poweroff.connect('clicked', sig_suspend)
b_poweroff = window.add_button('Poweroff', 12)
b_poweroff.connect('clicked', sig_poweroff)
window.show_all()
gtk.main()
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment