【pygame】pythonでゲーム製作【ぱいがめ】at GAMEDEV【pygame】pythonでゲーム製作【ぱいがめ】 - 暇つぶし2ch■コピペモード□スレを通常表示□オプションモード□このスレッドのURL■項目テキスト211:208 08/01/08 01:45:06 3fTMIMrl >>210 wiki に載ってるコードはwindowsだとだめなのかな。 os.environ['SDL_WINDOWID'] で環境変数いじってもpygame側に反映されないっぽい。 ctypes で putenv したらうまくいきました。 ---- begin ---- $ diff -up wxpygametest.py.orig wxpygametest.py --- wxpygametest.py.orig 2008-01-08 01:39:43.607875000 +0900 +++ wxpygametest.py 2008-01-08 01:40:18.717250000 +0900 @@ -2,6 +2,7 @@ import wx import os import thread global pygame # when we import it, let's keep its proper name! +import ctypes class SDLThread: def __init__(self,screen): @@ -37,8 +38,8 @@ class SDLPanel(wx.Panel): global pygame wx.Panel.__init__(self, parent, ID, size=tplSize) self.Fit() - os.environ['SDL_WINDOWID'] = str(self.GetHandle()) - os.environ['SDL_VIDEODRIVER'] = 'windib' + ctypes.cdll.msvcrt._putenv("SDL_VIDEODRIVER=windib") + ctypes.cdll.msvcrt._putenv("SDL_WINDOWID=%d" % (self.GetHandle())) import pygame # this has to happen after setting the environment variables. pygame.display.init() window = pygame.display.set_mode(tplSize) ---- end ---- 次ページ最新レス表示レスジャンプ類似スレ一覧スレッドの検索話題のニュースおまかせリストオプションしおりを挟むスレッドに書込スレッドの一覧暇つぶし2ch