-
Notifications
You must be signed in to change notification settings - Fork 9
toga-demo error in windows with python3.5 32-bit #4
Comments
Thanks for the report - this is a known problem; Windows support for Toga is fairly limited at the moment. If you've got experience with Windows GUI development, it's an area where we need a lot of help. |
@freakboy3742 Would be interested in working on it but would need some guidance on how to approach it! (newbie in contributing) |
Repeating some info provided in Gitter, as a guide to anyone interested in helping: The Windows backend that is there right now uses Win32 APIs, which are really old - so the apps look really old when they run. The problem, though, is that all the newer windows APIs are either C++ or C#. C++/C# APIs can’t use the ctypes trick that works on macOS, because there isn’t a common calling convention for C++ or C#. The C# bindings are the most interesting, because all the most recent APIs are C#. So - the first problem to tackle: How do you invoke a C# method from Python? There are two approaches I can think of. We could either:
(2) might sound complex, but it’s exactly what we’re doing with VOC to support Python on Android (except that it’s Java bytecode there) but before we go down that rabbit hole, I’d like to rule out whether (1) can be done. So - the initial exploratory task: Write a C# module with a C api that lets you get a reference to a C# class, invoke a method on the C# class, and so on. Call that C API from Python, using CTypes. |
Sound promising, Will give it a try! |
I'm interested in working on this. I can take a look at https://github.com/pythonnet/pythonnet before we meet up in Amsterdam in a week's time. Looks like a promising solution. |
I was initially looking at doing a backend that leverages WPF, but I'm not sure if that is the right thing to do. WPF was really meant to be used with XAML, so while one can use it without, it seems to be using it for something it isn't meant for. Also, we could use WinForms, but at that point, I think using the Common Controls through ctypes or such might be faster... I suppose just because no one uses WPF widgets solely outside of XAML shouldn't discourage us... @arnists if you are interested in working on it, I will defer to you to start the bindings if you want, I'm pretty busy anyway. |
You can look at pywebview to see how pythonnet can be used to write WinForms apps: https://github.com/r0x0r/pywebview Pythonnet repository has 3 demo GUI apps using WinForms, which should also run on Mono. Windows 10 has UWP, but the path for Python is not clear. |
I mean, Martin Loewis was able to port Python to WinRT (The Windows 8 app ecosystem). It shouldn't be too hard to port Python to UWP. I will point out WPF scales much better on HiDPI displays than WinForms. |
pythonnet also works with WPF, but I have not finished the demo yet: I did not find examples of WPF without XAML. XAML compiles to BAML binaries and has very tight coupling to WPF and .NET. |
I can't even use toga-demo app:
|
Should a new issue be opened to track implementing OptionContainer? (which is what the demo currently crashes on) |
@voltagex It's not essential; referencing the WIP PR on this ticket is essential. However, if you think a ticket will aid coordination, feel free. |
CPython on UWP: |
Does that run on Desktop UWP though? Last I heard it was Raspberry Pi/Arm only. |
executing toga-demo in command prompt gives the following error:
The text was updated successfully, but these errors were encountered: