Hello,
I have a very simple python script I want to compile into an exe-File (with
IronPython 2.6). The script is named "GuiTest.py":
### BEGIN GuiTest.py ###
import clr
clr.AddReference("PresentationFramework")
clr.AddReference("PresentationCore")
import System.Windows
import System.Windows.Controls
window = System.Windows.Window()
window.Title = "GuiTest"
window.Height = 200
window.Width = 450
stack = System.Windows.Controls.StackPanel()
stack.Margin = System.Windows.Thickness(15)
window.Content = stack
button = System.Windows.Controls.Button() button.Content = "Push Me!"
def onClick(sender, event):
print "Button pushed!"
button.Click += onClick
stack.Children.Add(button)
app = System.Windows.Application()
app.Run(window)
### END GuiTest.py ###
By using "pyc.py" I created "GuiTest.exe" with the following command line:
ipy "C:\Programme\IronPython 2.6\Tools\Scripts\pyc.py" /main:GuiTest.py
/target:exe
Next I copied the following files into the same folder where GuiTest.exe is
stored:
IronPython.dll
IronPython.Modules.dll
Microsoft.Scripting.ExtensionAttribute.dll
Microsoft.Dynamic.dll
Microsoft.Scripting.Core.dll
Microsoft.Scripting.Debugging.dll
Microsoft.Scripting.dll
Unfortunatelly GuiTest.exe still doesn't work. If I try to execute it from
the command line I get the following error message:
Unbehandelte Ausnahme: System.InvalidOperationException: Beim aufrufenden
Thread muss es sich um einen STA-Thread handeln, da dies für viele
Komponenten der Benutzeroberfläche erforderlich ist.
bei
Microsoft.Scripting.Actions.Calls.MethodCandidate.Caller.Call(Object[] args,
Boolean& shouldOptimize)
bei
IronPython.Runtime.Types.BuiltinFunction.BuiltinFunctionCaller`6.Call5(Ca
llSite site, CodeContext context, TFuncType func, T0 arg0, T1 arg1, T2 arg2,
T3arg3, T4 arg4)
bei
System.Dynamic.UpdateDelegates.UpdateAndExecute7[T0,T1,T2,T3,T4,T5,T6,TRet](CallSite
site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6)
bei IronPython.Runtime.Importer.Import(CodeContext context, String
fullName, PythonTuple from, Int32 level)
bei IronPython.Runtime.Operations.PythonOps.InitializeModule(Assembly
precompiled, String main, String[] references)
bei PythonMain.Main()
Do you have any ideas how I can resolve this issue?
Best regards,
Xaphier N.
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com