could you help me with my problem?
code for first run work fine (save screenshot). on second buttonpress EG do nothing (interface does not locking i can configure and so on) and then in 1 min windows close EG with error
i'm new in phyton but i think that code is ok and problem in threads or some with memory, access or rights
win7 64, EG 0.4.1 r1640
Code: Select all
import wx, ctypes, datetime
app = wx.PySimpleApp()
SM_XVIRTUALSCREEN = 76
SM_YVIRTUALSCREEN = 77
SM_CXVIRTUALSCREEN = 78
SM_CYVIRTUALSCREEN = 79
user32 = ctypes.windll.user32
width, height = user32.GetSystemMetrics(SM_CXVIRTUALSCREEN), user32.GetSystemMetrics(SM_CYVIRTUALSCREEN)
x, y = user32.GetSystemMetrics(SM_XVIRTUALSCREEN), user32.GetSystemMetrics(SM_YVIRTUALSCREEN)
screen = wx.ScreenDC()
bmp = wx.EmptyBitmap(width, height)
mem = wx.MemoryDC(bmp)
mem.Blit(0, 0, width, height, screen, x, y)
del mem
date = datetime.datetime.now()
str = date.strftime("%Y%m%d%H%M%S")
str = u'D:\Pictures\screenshot'+str+'.png'
bmp.SaveFile(str, wx.BITMAP_TYPE_PNG)Code: Select all
15:23:30: 0 MainThread: ----------------------------------------
15:23:30: 0 MainThread: EventGhost started
15:23:30: 0 MainThread: ----------------------------------------
15:23:30: 0 MainThread: Version: 0.4.1.r1640
15:23:30: 0 MainThread: missing guid in plugin: C:\Program Files (x86)\EventGhost\plugins\GameVoice
15:23:31: 0 MainThread: missing guid in plugin: C:\Program Files (x86)\EventGhost\plugins\Ping
15:23:31: 0 MainThread: PluginManager.ScanAllPlugins :0.10622506466438879
15:23:31: 0 MainThread: SendKeysParser.__init__()
15:23:31: 0 MainMessageReceiver: MainMessageReceiver.__MainLoop()
15:23:31: 0 MainMessageReceiver: MainMessageReceiver.Setup()
15:23:31: 0 MainThread: Document.ShowFrame()
15:23:31: 0 MainThread: Log.GetData()
15:23:31: 0 MainThread: Document.ShowFrame => None
15:23:31: 0 ActionThread: ActionThread.__MainLoop()
15:23:31: 0 EventThread: EventThread.__MainLoop()
15:23:31: 0 EventThread: EventThread.StartSession(filename=u'C:\\Program Files (x86)\\EventGhost\\11.xml')
15:23:31: 0 ActionThread: ActionThread.StartSession(filename=u'C:\\Program Files (x86)\\EventGhost\\11.xml')
15:23:31: 0 SchedulerThread: SessionChangeNotifier.Register()
15:23:31: 0 MouseThread: MouseThread.run()
15:23:31: 0 ActionThread: Document.Load(filePath=u'C:\\Program Files (x86)\\EventGhost\\11.xml')
15:23:31: 1 MainThread: OSDFrame.__init__(parent=None)
15:23:31: 0 ActionThread: StartLoad(cls=<class 'eg.Classes.TreeLink.TreeLink'>)
15:23:31: 0 ActionThread: XML loaded in 0.021464 seconds.
15:23:31: 0 ActionThread: MceRemote.__start__(waitTime=0.14999999999999999, disableHid=True)
15:23:31: 0 MceMessageReceiver: MceMessageReceiver.__MainLoop()
15:23:31: 0 ActionThread: ActionThread.StartSession => None
15:23:39: 0 ActionThread: Exception in __DoOneEvent
Exception in thread ActionThread:
Traceback (most recent call last):
File "threading.pyc", line 532, in __bootstrap_inner
File "threading.pyc", line 484, in run
File "C:\Program Files (x86)\EventGhost\eg\Utils.py", line 127, in LogItWithReturnWrapper
result = func(*args, **kwargs)
File "C:\Program Files (x86)\EventGhost\eg\Classes\ThreadWorker.py", line 354, in __MainLoop
self.__DoOneEvent()
File "C:\Program Files (x86)\EventGhost\eg\Classes\ThreadWorker.py", line 342, in __DoOneEvent
eg.PrintTraceback()
File "C:\Program Files (x86)\EventGhost\eg\Classes\Log.py", line 204, in PrintTraceback
self.Write(error.rstrip() + "\n", ERROR_ICON, source)
File "C:\Program Files (x86)\EventGhost\eg\Classes\Log.py", line 151, in Write
wx.CallAfter(self._WriteLine, line, icon, wRef, when, eg.indent)
File "wx\_core.pyc", line 14655, in CallAfter
AssertionError: No wx.App created yet
Exception in thread Thread-7:
Traceback (most recent call last):
File "threading.pyc", line 532, in __bootstrap_inner
File "threading.pyc", line 736, in run
File "C:\Program Files (x86)\EventGhost\plugins\MceRemote\__init__.py", line 246, in OnTimeOut
self.lastEvent.SetShouldEnd()
File "C:\Program Files (x86)\EventGhost\eg\Classes\EventGhostEvent.py", line 117, in SetShouldEnd
eg.SetProcessingState(0, self)
File "C:\Program Files (x86)\EventGhost\eg\Classes\TaskBarIcon.py", line 111, in SetProcessingState
wx.CallAfter(eg.Notify, "ProcessingChange", state)
File "wx\_core.pyc", line 14655, in CallAfter
AssertionError: No wx.App created yet
15:24:08: 1 MainThread: MainFrame.OnClose(dummyEvent=<wx.CloseEvent>)
15:24:08: 1 MainThread: App.Exit()
15:24:08: 1 MainThread: Document.CheckFileNeedsSave()
15:24:08: 1 MainThread: Document.CheckFileNeedsSave => 5100
15:24:08: 1 MainThread: Document.Close()
15:24:08: 1 MainThread: MainFrame.Destroy()
15:24:08: 1 MainThread: LogCtrl.Destroy()
15:24:08: 1 MainThread: TreeCtrl.Destroy()
15:24:08: 1 MainThread: StatusBar.Destroy()
15:24:08: 1 MainThread: MainFrame.Destroy => True
15:24:08: 1 MainThread: Document.GetExpandState()
15:24:08: 1 MainThread: Document.Close => None