в чём дело? код просто питон выключает  пожалуйста, подскажите 
Код | >>> from datetime import datetime >>> import PIL.Image, model, Numeric >>> try: ... import pygtk ... pygtk.require("2.0") ... except: ... pass ... >>> try: ... import gtk ... import gtk.glade ... except: ... sys.exit(1) ... >>> class VisitWidget(object): ... gladefile = '/home/pythonwin/Desktop/GTK//template/project1.glade' ... window_name = 'window1' ... def __init__(self, **kw): ... self.wTree = gtk.glade.XML(self.gladefile, self.window_name) ... dic = {'on_window1_delete_event':self.close_application} ... self.set_date() ... self.wTree.signal_autoconnect(dic) ... def close_application(self, widget, event, data=None): ... gtk.main_quit() ... return False ... def set_date(self): ... self.imageFoto = self.wTree.get_widget('imageFoto') ... i = PIL.Image.open('/home/pythonwin/Desktop/GTK/fern.jpg') ... w, h = i.size ... imagestr = i.tostring() ... pixmap = gtk.gdk.Pixmap(self.imageFoto.window, w, w, 1) ... gc = self.imageFoto.style.fg_gc[gtk.STATE_NORMAL] ... x=y=0 ... buff=imagestr ... pixmap.draw_rgb_image(gc, x, y, w, h, gtk.gdk.RGB_DITHER_NONE, buff) ... self.imageFoto.set_from_pixmap(pixmap, None) ... >>> someclass = VisitWidget() __main__:21: GtkWarning: The gdk_draw_*_image require the drawable argument to have a specified colormap. All windows have a colormap, however, pixmaps only have colormap by default if they were created with a non-NULL window argument. Otherwise a colormap must be set on them with gdk_drawable_set_colormap >>> gtk.main() The program '.' received an X Window System error. This probably reflects a bug in the program. The error was 'BadMatch (invalid parameter attributes)'. (Details: serial 226 error_code 8 request_code 62 minor_code 0) (Note to programmers: normally, X errors are reported asynchronously; that is, you will receive the error a while after causing it. To debug your program, run it with the --sync command line option to change this behavior. You can then get a meaningful backtrace from your debugger if you break on the gdk_x_error() function.)
|
|