from gtk import *

try:
 import sg
except:
 sg=0

def fl(button):
  print("Button pressed")

def test_window(text="Test"):

  w=GtkWindow()

  button=GtkButton(text)
  button.connect("clicked", fl)
  w.add(button)

  w.show_all()

if (sg):
 sg.new_plugin_group("Worksheet:Test:")
 sg.register_plugin("Test module","Worksheet:Test:",test_window)


syntax highlighted by Code2HTML, v. 0.9.1