[Ironpython-users] GUI Toolkits

Jeff Hardy jdhardy at gmail.com
Wed Dec 3 14:57:01 CET 2014


On Wed, Dec 3, 2014 at 9:19 AM, Andrew Ayre <andy at britishideas.com> wrote:

> Hi Markus,
>
> Thanks for responding to my plea for help. I was leaning towards
> something like your first suggestion but I like your second suggestion
> better! HTML opens up possibilities for users to add logos, etc to their
> forms if they wish, and HTML is widely known.
>

This is a really common pattern on mobile apps, actually - host most of the
app in a WebView and just have a bit of chrome around it to control things.

I never realized that WebBrowserControl had the two-way capabilities that
it does (c.f.
http://msdn.microsoft.com/en-us/library/a0746166(v=vs.110).aspx).
Interesting possibilities there.


>
> Thanks again and I am glad I'm not the only one who sees a need for an
> easy to use UI when embedded IronPython.
>

I doubt you're the only one. Any chance you could make the code open-source
if the approach turns out to work?

- Jeff

P.S. I'd also kill for an open-source embeddable REPL and an embeddable
editor (with debugging for extra points).



>
> Andy
>
> On 12/2/2014 4:18 PM, Markus Schaber wrote:
> > Hi, Andrew,
> >
> > I just had another (maybe weird) idea:
> >
> > Maybe your users could use HTML Forms to define the UI, and you use an
> embedded WebbrowserControl to render the UI, and use the DOM tree to read
> and write the values. Create a slim python function for this which accepts
> an HTML form fragment and a dictionary with the values, and you should be
> done. :-)
> >
> > Best regards
> >
> > Markus Schaber
> >
> > CODESYS® a trademark of 3S-Smart Software Solutions GmbH
> >
> > Inspiring Automation Solutions
> >
> > 3S-Smart Software Solutions GmbH
> > Dipl.-Inf. Markus Schaber | Product Development Core Technology
> > Memminger Str. 151 | 87439 Kempten | Germany
> > Tel. +49-831-54031-979 | Fax +49-831-54031-50
> >
> > E-Mail: m.schaber at codesys.com | Web: http://www.codesys.com | CODESYS
> store: http://store.codesys.com
> > CODESYS forum: http://forum.codesys.com
> >
> > Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner |
> Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915
> >
> > This e-mail may contain confidential and/or privileged information. If
> you are not the intended recipient (or have received
> > this e-mail in error) please notify the sender immediately and destroy
> this e-mail. Any unauthorised copying, disclosure
> > or distribution of the material in this e-mail is strictly forbidden.
> >
> >> -----Ursprüngliche Nachricht-----
> >> Von: Markus Schaber
> >> Gesendet: Dienstag, 2. Dezember 2014 17:17
> >> An: 'Andrew Ayre'; ironpython-users at python.org
> >> Betreff: AW: [Ironpython-users] GUI Toolkits
> >>
> >> Hi, Andrew,
> >>
> >> I did embed IronPython into CODESYS. In our case, we already had a
> >> set of standard dialog functions in the framework which I exposed to
> >> the API available for the scripts:
> >>
> >> - Standard Error messages, Yes/No/Cancel prompts and similar dialogs
> >> (basically an improved Windows forms MessageBox)
> >>
> >> - Multiple Choice Prompt (The user can choose one of a list).
> >>
> >> - Choose Prompt (The user can use checkboxes to select individual
> >> items in a list).
> >>
> >> - Enter text (singleline and multiline)
> >>
> >> - Enter password
> >>
> >> - Enter username and password
> >>
> >> - File open / file save / choose directory (basically simplifying
> >> wrappers around the windows forms classes).
> >>
> >> Maybe most of the users can already work with a similar set of basic
> >> dialogs. You could also add some kind of "form layouter" where you
> >> give a list of tuples (name, value, type) and create a table layout
> >> based dialog form of it.
> >>
> >> You may as well find other Windows Forms or WPF based libraries on
> >> the net which you can expose in a simplified, wrapped way.
> >>
> >> When trying to use a different UI toolkit, you should be aware of 2
> >> problems:
> >>
> >> - IronPython is implemented very differently from cPython, so most
> >> probably, you will only get .NET libraries to work, not the GUI
> >> toolkits ported for cPython.
> >>
> >> - Due to the nature of the windows message loop system, it is rather
> >> hard to mix 2 different toolkits in the same process. So as long as
> >> your application uses Windows Forms, it will be very hard to mix it
> >> with any other UI toolkit (apart from native win32 and WPF, and even
> >> those have problems and limitations). For example, as far as I know,
> >> it is not possible to mix windows forms and GTK# or QT.NET in the
> >> same process, except using ugly workarounds like ActiveQT (using
> >> ActiveX / COM internally).
> >>
> >>
> >> Best regards
> >>
> >> Markus Schaber
> >>
> >> CODESYS® a trademark of 3S-Smart Software Solutions GmbH
> >>
> >> Inspiring Automation Solutions
> >>
> >> 3S-Smart Software Solutions GmbH
> >> Dipl.-Inf. Markus Schaber | Product Development Core Technology
> >> Memminger Str. 151 | 87439 Kempten | Germany Tel. +49-831-54031-979 |
> >> Fax +49-831-54031-50
> >>
> >> E-Mail: m.schaber at codesys.com | Web: http://www.codesys.com | CODESYS
> >> store: http://store.codesys.com CODESYS forum:
> >> http://forum.codesys.com
> >>
> >> Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner |
> >> Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915
> >>
> >> This e-mail may contain confidential and/or privileged information.
> >> If you are not the intended recipient (or have received this e-mail
> >> in error) please notify the sender immediately and destroy this e-
> >> mail. Any unauthorised copying, disclosure or distribution of the
> >> material in this e-mail is strictly forbidden.
> >>
> >>> -----Ursprüngliche Nachricht-----
> >>> Von: Ironpython-users [mailto:ironpython-users-
> >>> bounces+m.schaber=codesys.com at python.org] Im Auftrag von Andrew
> >> Ayre
> >>> Gesendet: Donnerstag, 20. November 2014 09:32
> >>> An: ironpython-users at python.org
> >>> Betreff: Re: [Ironpython-users] GUI Toolkits
> >>>
> >>> Hi Haymo,
> >>>
> >>> Thanks for responding.
> >>>
> >>> Sorry, I should have clarified something. I never run IronPython
> >>> standalone. I only use it embedded in my C# applications. For me
> >> that
> >>> is the single biggest advantage of IronPython.
> >>>
> >>> I understand what you are saying. I'm a professional software
> >>> developer familiar with all these technologies, so I know what is
> >>> involved to make it work. However....
> >>>
> >>> The users of my application are non-technical. They need to be
> >> gently
> >>> coaxed into even considering using python for the first time.
> >>>
> >>> Of course WinForms is already there in my app for anyone to use
> >> from
> >>> IronPython, but what I need to supplement this is a much simpler
> >> GUI
> >>> system that has an easier learning curve, so my users won't be
> >>> frightened off. Then they have a choice:
> >>>
> >>>    - full blown winforms
> >>>    - something simpler and familiar to most python users
> >>>
> >>> Thanks, Andy
> >>>
> >>> On 11/19/2014 11:47 PM, Haymo Kutschbach wrote:
> >>>> Andy, for my understanding one of the biggest advantage of having
> >>>> IronPython is to actually be able to use things like winforms? As
> >>> for
> >>>> all systems it will require some learning to begin with, of
> >> course.
> >>>> But in fact very little is required in order to get so much more
> >>> than
> >>>> any of the systems mentioned in your link is able to provide.
> >>>>
> >>>> If you need a very newbee example: I recently had some fun
> >>>> experimenting with IronPython to create interactive scientific 3d
> >>>> plots in less than 10
> >>>> lines:
> >>>>
> >>>> http://ilnumerics.net/blog/plotting-fun-with-ilnumerics-and-
> >>> ironpython
> >>>> /
> >>>>
> >>>> Having winforms and the whole .NET framework in the back, I can
> >>> hardly
> >>>> imagine to recommend Tcl/TK any time soon... ;)
> >>>>
> >>>> Best, Haymo
> >>>>
> >>>
> >>> --
> >>> Andy
> >>> PGP Key ID: 0xDC1B5864
> >>> _______________________________________________
> >>> Ironpython-users mailing list
> >>> Ironpython-users at python.org
> >>> https://mail.python.org/mailman/listinfo/ironpython-users
> >
> >
> >
>
> --
> Andy
> PGP Key ID: 0xDC1B5864
> _______________________________________________
> Ironpython-users mailing list
> Ironpython-users at python.org
> https://mail.python.org/mailman/listinfo/ironpython-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20141203/460f0fd1/attachment.html>


More information about the Ironpython-users mailing list