fpdb/test_Python_Libs.py

83 lines
2.3 KiB
Python
Raw Permalink Normal View History

2010-07-08 20:01:03 +02:00
#!/usr/bin/env python
# -*- coding: utf-8 -*-
2009-12-08 23:48:52 +01:00
"""test2.py
Test if gtk is working.
"""
2011-03-10 06:16:31 +01:00
# Copyright 2008-2011, Ray E. Barker
2009-12-08 23:48:52 +01:00
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
########################################################################
import sys
import os
2009-12-08 23:48:52 +01:00
try:
import gobject as _gobject
print "Import of gobject:\tSuccess"
2009-12-08 23:48:52 +01:00
import pygtk
print "Import of pygtk:\tSuccess"
2009-12-08 23:48:52 +01:00
pygtk.require('2.0')
import gtk
print "Import of gtk:\t\tSuccess"
import pango
print "Import of pango:\tSuccess"
2009-12-08 23:48:52 +01:00
if os.name == 'nt':
import win32
import win32api
print "Import of win32:\tSuccess"
try:
import matplotlib
matplotlib.use('GTK')
print "Import of matplotlib:\tSuccess"
import numpy
print "Import of numpy:\tSuccess"
import pylab
print "Import of pylab:\tSuccess"
except:
print "\nError:", sys.exc_info()
print "\npress return to finish"
sys.stdin.readline()
2009-12-08 23:48:52 +01:00
win = gtk.Window(gtk.WINDOW_TOPLEVEL)
win.set_title("Test GTK")
win.set_border_width(1)
win.set_default_size(600, 500)
win.set_resizable(True)
#win.show()
dia = gtk.Dialog("Test GTK",
win,
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
(gtk.STOCK_CLOSE, gtk.RESPONSE_OK))
dia.set_default_size(500, 300)
l = gtk.Label("GTK is working!\n")
2009-12-08 23:48:52 +01:00
dia.vbox.add(l)
l.show()
response = dia.run()
if response == gtk.RESPONSE_ACCEPT:
pass
dia.destroy()
except:
print "\nError:", sys.exc_info()
print "\npress return to finish"
sys.stdin.readline()