os.putenv('SDL_WINDOWID', str(area.window.xid))
me da error:
os.putenv('SDL_WINDOWID', str(area.window.xid ))
AttributeError: xid attribute not supported
Por lo que anduve viendo supuestamente el error es porque no puedo obtener el xid en "Windows" y si funciona en Linux. Como puedo hacer para que funcione en windows?, hay algún comando similar?
Pongo el ejemplo que estoy probando para que vean todo el codigo, al eje lo saque de este foro de la siguiente url: viewtopic.php?f=9&t=639
Codigo:
- Código: Seleccionar todo
import gobject
import gtk
import os
import pygame
WINX = 400
WINY = 200
window = gtk.Window()
window.connect('delete-event', gtk.main_quit)
window.set_resizable(False)
area = gtk.DrawingArea()
area.set_app_paintable(True)
area.set_size_request(WINX, WINY)
window.add(area)
area.realize()
# Force SDL to write on our drawing area
os.putenv('SDL_WINDOWID', str(area.window.xid ))
# We need to flush the XLib event loop otherwise we can't
# access the XWindow which set_mode() requires
gtk.gdk.flush()
pygame.init()
pygame.display.set_mode((WINX, WINY), 0, 0)
screen = pygame.display.get_surface()
color = (0, 0, 0)
message = pygame.font.Font(None, 30)
img = message.render("Pulse el mouse para crear otra ventana", 1, color)
def loop():
"Se llama constantemente en todo momento."
screen.fill((255, 255, 255))
screen.blit(img, (0, 0))
pygame.display.update()
return True
def on_event(widget, event):
"Se activa cada vez que se produce un evento."
if event.type == gtk.gdk.KEY_PRESS:
other = gtk.Window()
label = gtk.Label("Hola")
other.add(label)
other.set_size_request(200, 70)
other.show_all()
window.connect("event", on_event)
gobject.idle_add(loop)
window.show_all()
gtk.main()
Saludos y gracias!
Diego