Prev: Changing Locale for datetime.strptime conversions
Next: Download Microsoft C/C++ compiler for use with Python 2.6/2.7 ASAP
From: Thomas Jollans on 6 Jul 2010 07:45 On 07/06/2010 12:15 PM, francisco dorset wrote: > hey am a programmer i have good knowledge of the c language and i will > like to now how i can use to python to provide graphical user-interface > for my c programs and or the steps involved in doing this and is it > possible???? > > if yes i will also like some resources or books to learn from..... > > any info will be useful thankss!!!! Three ways of doing this: 1. Turn your C program into a library, and write a Python extension module to interface it. 2. Embed Python in your C program. 3. If you're talking command-line programs, you can interface the compiled programs with the subprocess module. For (1) and (2), start with the Extending/Embedding section at http://docs.python.org/py3k/ (or http://docs.python.org/). With (1), using Cython or SWIG might make writing the "glue" between Python and your C code easier. For (3), check the docs of the subprocess module. It might, however, be best to simply write the GUI in C as well, which would avoid the overhead of loading Python and isn't all that difficult either. If you know C++, check out wxWidgets and Qt4. To stick with plain C, have a look at GTK+. Cheers, Thomas
From: bobicanprogram on 6 Jul 2010 08:56 On Jul 6, 7:45 am, Thomas Jollans <tho...(a)jollans.com> wrote: > On 07/06/2010 12:15 PM, francisco dorset wrote: > > > hey am a programmer i have good knowledge of the c language and i will > > like to now how i can use to python to provide graphical user-interface > > for my c programs and or the steps involved in doing this and is it > > possible???? > > > if yes i will also like some resources or books to learn from..... > > > any info will be useful thankss!!!! > > Three ways of doing this: > > 1. Turn your C program into a library, and write a Python extension > module to interface it. > > 2. Embed Python in your C program. > > 3. If you're talking command-line programs, you can interface the > compiled programs with the subprocess module. > > For (1) and (2), start with the Extending/Embedding section athttp://docs.python.org/py3k/(orhttp://docs.python.org/). With (1), > using Cython or SWIG might make writing the "glue" between Python and > your C code easier. > > For (3), check the docs of the subprocess module. > > It might, however, be best to simply write the GUI in C as well, which > would avoid the overhead of loading Python and isn't all that difficult > either. If you know C++, check out wxWidgets and Qt4. To stick with > plain C, have a look at GTK+. > > Cheers, > Thomas You might want to also look at the SIMPL toolkit (http:// www.icanprogram.com/06py/lesson1/lesson1.html). You could use Send/ Receive/Reply (QNX style) messaging to add a Python GUI to a C program. There are examples of just this at the link above. bob
From: sturlamolden on 6 Jul 2010 14:14 On 6 Jul, 13:45, Thomas Jollans <tho...(a)jollans.com> wrote: > 1. Turn your C program into a library, and write a Python extension Note that using ctypes, Cython or Boost.Python is much less painful than using Python's C API directly. > It might, however, be best to simply write the GUI in C as well, which > would avoid the overhead of loading Python and isn't all that difficult > either. If you know C++, check out wxWidgets and Qt4. To stick with > plain C, have a look at GTK+. You will hardly notice the overhead of loading Python. (It's not Java...) Also a good GUI builder is far more important than language when it comes to making a GUI. Depending on toolkit my preferences are wxFormBuilder, Qt Designer, GLADE or MS Visual Studio. - wxFormBuilder are beginning to be ok for wxPython development without XRC, finally. - PyQt has licensing issues, although Qt is LGPL. PySide is still incomplete. - GLADE/PyGTK has issues on Windows (e.g. need to supply a GTK+ run- time). - Visual Studio can be used for IronPython .NET and native MFC (pywin32 has MFC bindings). - tkinter generally sucks (tedious to use, looks bad).
From: rantingrick on 6 Jul 2010 14:23
On Jul 6, 1:14 pm, sturlamolden <sturlamol...(a)yahoo.no> wrote: > Also a good GUI builder is far more important than language when it > comes to making a GUI. Depending on toolkit my preferences are > wxFormBuilder, Qt Designer, GLADE or MS Visual Studio. Thats only true when using any language EXCEPT Python. With Python, Python is all you need. Python GUI builders are for pansies. However when using the redundantly asinine C, C++, and Java... well your already getting bent over, might as well bring some lubrication to ease the pain! |