News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Is Python built into Code::Blocks?

Started by Slothsy, July 02, 2013, 06:50:09 PM

Previous topic - Next topic

Slothsy

As the title says. If there is anyway to get it on can you please reply to this post? I really need it! Thanks.

thomas

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).
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Slothsy

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.

Jenna

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.

Slothsy

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++.  :)

Jenna

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.

thomas

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.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

oBFusCATed

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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

LETARTARE


sous Windows, you can also write for example:

#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.
CB-13834, plugins-sdk-2.25.0 : Collector-2.6.5, AddOnForQt-5.1.2
1- Win7 Business Pack1 64bits : wx-3.2.8, gcc-15.2.0,
2- OpenSuse::Leap-15.6-64bits : wx-3.2.8;gtk3-u, gcc-15.2.0,
=> !! The messages are translated by 'Deepl'