Code::Blocks Forums

User forums => Help => Topic started by: Slothsy on July 02, 2013, 06:50:09 pm

Title: Is Python built into Code::Blocks?
Post by: Slothsy on July 02, 2013, 06:50:09 pm
As the title says. If there is anyway to get it on can you please reply to this post? I really need it! Thanks.
Title: Re: Is Python built into Code::Blocks?
Post by: thomas on July 02, 2013, 06:54:48 pm
Python is not built into Code::Blocks, and there is no easy way of getting it built into it. Code::Blocks uses Squirrel as application scripting language.

However, you can trivially just install Python aside of Code::Blocks (of course without any bindings within the Code::Blocks application).
Title: Re: Is Python built into Code::Blocks?
Post by: Slothsy on July 02, 2013, 06:56:34 pm
I have it already installed, but i just wanted to use code::blocks with it because of how you open a new window when you run the program and it can get irritating sometimes.
Title: Re: Is Python built into Code::Blocks?
Post by: Jenna on July 02, 2013, 06:58:59 pm
SImple answer:
no.

C::B is an IDE with no builtin languages.

If you mean, whether there is a plugin that supports python, then the answer is yes as far as I know.
But not in trunk and therefore not installed by default.
Title: Re: Is Python built into Code::Blocks?
Post by: Slothsy on July 02, 2013, 07:01:16 pm
Please can you send me the link, I REALLY NEED IT. Plus i want to get used to Code::Blocks for when i start to learn C++.  :)
Title: Re: Is Python built into Code::Blocks?
Post by: Jenna on July 02, 2013, 07:06:30 pm
I do not have a link, search the wen and/or the forum.
But i's a plugin to develop python applications, not to use python as scripting-engine for C::B, this is not easily possible as thomas wrote.
Title: Re: Is Python built into Code::Blocks?
Post by: thomas on July 02, 2013, 08:53:49 pm
It really depends which of the two things you want.

If you want to develop Python scripts in Code::Blocks, you can do that, although it is not primarily designed for that purpose. Still, you can edit source code and organize source files in a project just fine, and you can launch python.exe either as tool or with a (relatively simple) compiler plugin, instead of running a compiler. Maybe such a plugin already exists, too.

If you want to use Python scripting within Code::Blocks, the answer is simply: bad luck for you.
Title: Re: Is Python built into Code::Blocks?
Post by: oBFusCATed on July 02, 2013, 10:14:13 pm
Here are the plugins for python/scripting languages: http://developer.berlios.de/projects/cbilplugin/
Our fellow dmoore works on them.
But be prepared to compile C++ code.
Title: Re: Is Python built into Code::Blocks?
Post by: LETARTARE on July 03, 2013, 08:48:44 am

sous Windows, you can also write for example:
Code
#include <Python.h>

int main()
{
    Py_Initialize();
    PyRun_SimpleString (//"# This Python file uses the following encoding: utf-8\n"
"# -*- coding: iso-8859-1 -*-\n"
"import serial\n"
"from serial.tools import list_ports\n"

"listeport=list_ports.comports()\n"
"print 'Hardware serial ports :'\n"
"n=0\n"
"for tu in listeport:\n"
" print n, tu\n"
" n+=1\n"

"import serialenum\n"
"listeport=serialenum.enumerate()\n"
"print 'All serial ports :'\n"
"n=0\n"
"for tu in listeport:\n"
" print n, tu\n"
" n+=1\n"
"\n"
);
    Py_Finalize();
    return 0;
}
and compile with gcc, gives exe file.