combining a C# GUI with Python code?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Salerno

    #1

    combining a C# GUI with Python code?

    Is it possible to construct a C# form (using Visual Studio) but write
    only Python code for the events? Is there some way to tell your program
    to run Python whenever code is run, since it will be all Python code
    (e.g. for button presses, etc.)?

    I know it's sort of silly, and it makes your program depend on .NET, but
    it would be a nice and easy way to create a GUI while still writing in
    Python, if it's possible.
  • Luis M. González

    #2
    Re: combining a C# GUI with Python code?

    First of all, you should be thinking about ironpython instead of
    cpython.
    This way you can forget about c# and do it all in (iron)python.
    I don't know its current state, but Microsoft is working in a Visual
    Studio - Ironpython integration.

    For more info:


    Comment

    • Luis M. González

      #3
      Re: combining a C# GUI with Python code?

      Now that I think about it, I'm not sure if Visual Studio can create
      GUIs with ironpython already. I guess that at this moment, its
      integration is as a text editor only (I may be wrong though).

      I almost forgot it, but someone was working in a little tool that
      converts C# forms into python classes (for being used with ironpython).

      Check it out: http://www.digitalfanatics.org/e8johan/projects/cs2py/

      Comment

      • John Salerno

        #4
        Re: combining a C# GUI with Python code?

        Luis M. González wrote:[color=blue]
        > Now that I think about it, I'm not sure if Visual Studio can create
        > GUIs with ironpython already. I guess that at this moment, its
        > integration is as a text editor only (I may be wrong though).
        >
        > I almost forgot it, but someone was working in a little tool that
        > converts C# forms into python classes (for being used with ironpython).
        >
        > Check it out: http://www.digitalfanatics.org/e8johan/projects/cs2py/
        >[/color]

        Thanks for the information!

        Comment

        • gangesmaster

          #5
          Re: combining a C# GUI with Python code?

          see http://interpython.sourceforge.net

          Comment

          • Rony Steelandt

            #6
            Re: combining a C# GUI with Python code?

            Isn't it a bit overkill to implement the whole .net framework 'Just'
            for a GUI ??

            If you want to build quickly nice GUI's for your python program, have a
            look at wxpython & wxdesigner

            Rony

            [color=blue]
            > Is it possible to construct a C# form (using Visual Studio) but write only
            > Python code for the events? Is there some way to tell your program to run
            > Python whenever code is run, since it will be all Python code (e.g. for
            > button presses, etc.)?
            >
            > I know it's sort of silly, and it makes your program depend on .NET, but it
            > would be a nice and easy way to create a GUI while still writing in Python,
            > if it's possible.[/color]


            --
            ---
            Rony Steelandt
            BuCodi
            rony dot steelandt (at) bucodi dot com

            Visit the python blog at http://360.yahoo.com/bucodi


            Comment

            • Gerard Flanagan

              #7
              Re: combining a C# GUI with Python code?


              John Salerno wrote:[color=blue]
              > Is it possible to construct a C# form (using Visual Studio) but write
              > only Python code for the events? Is there some way to tell your program
              > to run Python whenever code is run, since it will be all Python code
              > (e.g. for button presses, etc.)?
              >
              > I know it's sort of silly, and it makes your program depend on .NET, but
              > it would be a nice and easy way to create a GUI while still writing in
              > Python, if it's possible.[/color]

              code here any use:



              ?

              Gerard

              Comment

              • John Salerno

                #8
                Re: combining a C# GUI with Python code?

                Rony Steelandt wrote:[color=blue]
                > Isn't it a bit overkill to implement the whole .net framework 'Just'
                > for a GUI ??
                >
                > If you want to build quickly nice GUI's for your python program, have a
                > look at wxpython & wxdesigner[/color]

                wxdesigner looked good until I had to pay. :(

                Comment

                • BartlebyScrivener

                  #9
                  Re: combining a C# GUI with Python code?

                  John,

                  I know you started out asking about .NET, but peruse this thread,
                  wherein some old hands recommend staying with what you know, if what
                  you know is VBA guis.

                  http://tinyurl.com/ehujm

                  rick

                  Comment

                  • Luis M. González

                    #10
                    Re: combining a C# GUI with Python code?

                    PythonCard is based on wxpython and it's free:
                    python, programming, hypercard, gui, development


                    Comment

                    • James

                      #11
                      Re: combining a C# GUI with Python code?

                      Yes! It is. Just make your GUI in C# and assign event handlers using
                      Python for .NET


                      Python for .NET is a great tool and has a minimal learning curve.
                      Unfortunately, it hasn't attracted enough attention from the Python
                      community. It does not have a .NET 2.0 release yet but it is in the
                      works.

                      Or you could use Boo with SharpDevelop. You will get Visual form design
                      with a very Pythonic language. But you won't get to use Python
                      libraries.

                      IronPython is getting IDE integration in the CTP releases for Visual
                      Studio. Maybe it will support form design in the future. I have not
                      tried it yet.

                      Comment

                      Working...