473,388 Members | 1,177 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

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.
May 19 '06 #1
10 7449
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:
http://lists.ironpython.com/htdig.cg...ry/001752.html

May 19 '06 #2
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/

May 19 '06 #3
Luis M. González wrote:
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/


Thanks for the information!
May 19 '06 #4
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

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.

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

Visit the python blog at http://360.yahoo.com/bucodi
May 20 '06 #6

John Salerno wrote:
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.


code here any use:

http://gflanagan.net/site/dotnet/05/...tFromWord.html

?

Gerard

May 20 '06 #7
Rony Steelandt wrote:
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


wxdesigner looked good until I had to pay. :(
May 20 '06 #8
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

May 20 '06 #9
PythonCard is based on wxpython and it's free:
http://pythoncard.sourceforge.net/

May 21 '06 #10
Yes! It is. Just make your GUI in C# and assign event handlers using
Python for .NET
http://www.zope.org/Members/Brian/PythonNet/

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.

May 21 '06 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Dave Blackington | last post by:
Hi, I'm trying to figure out how to combine an 'if' and 'else' statement on one line. Tonight I was programming and came up with a very short if/else scenario that demanded 4 lines due to the...
3
by: Magnus Lie Hetland | last post by:
If I want to specify both mode and source encoding using the -*- FOO -*- syntax in emacs -- how can I do that? Both insist on being on the second line of the file, yet I have found no way of...
7
by: Hansan | last post by:
Hi all, I hope you have time to help me out a little. My problem is that I want to combine some python code I have made with some html templates, I found a tutorial at dev shed:...
2
by: Chris Mullins | last post by:
I've spent a bit of time over the last year trying to implement RFC 3454 (Preparation of Internationalized Strings, aka 'StringPrep'). This RFC is also a dependency for RFC 3491...
9
by: Tim Daneliuk | last post by:
So it is claimed: http://www.infoq.com/news/Scala--combing-the-best-of-Ruby-;jsessionid=CC7C8366455E67B04EE5864B7319F5EC Has anyone taken a look at this that can provide a meaningful contrast...
2
by: Turbo | last post by:
How to get absolute uri by combining the baseuri and the relative uri in an html page using javscript? I am looking for something similar to python's urlparse.urljoin('baseuri', 'relativeuri');...
10
by: wo_shi_big_stomach | last post by:
Newbie to python writing a script to recurse a directory tree and delete the first line of a file if it contains a given string. I get the same error on a Mac running OS X 10.4.8 and FreeBSD 6.1. ...
2
by: Osiris | last post by:
I found this text about combining C-code with Pyton scripting on the P2P networks in PDF: Python Scripting for Computational Science Hans Petter Langtangen Simula Research Laboratory and...
5
by: TokiDoki | last post by:
Hi! I have a Python problem which is my last problem to solve to finish up a Django application. This is amazingly simple but I have been stuck now for a couple of days. It is embarrisingly...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.