Author Topic: Is Python built into Code::Blocks?  (Read 26526 times)

Offline Slothsy

  • Single posting newcomer
  • *
  • Posts: 3
Is Python built into Code::Blocks?
« 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.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Is Python built into Code::Blocks?
« Reply #1 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).
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Slothsy

  • Single posting newcomer
  • *
  • Posts: 3
Re: Is Python built into Code::Blocks?
« Reply #2 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.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Is Python built into Code::Blocks?
« Reply #3 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.

Offline Slothsy

  • Single posting newcomer
  • *
  • Posts: 3
Re: Is Python built into Code::Blocks?
« Reply #4 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++.  :)

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Is Python built into Code::Blocks?
« Reply #5 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.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Is Python built into Code::Blocks?
« Reply #6 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.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Is Python built into Code::Blocks?
« Reply #7 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.
(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!]

Offline LETARTARE

  • Lives here!
  • ****
  • Posts: 531
  • L'ami de l'homme.The friend of man.
    • LETARTARE
Re: Is Python built into Code::Blocks?
« Reply #8 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.
CB-13515, plugins-sdk-2.25.0 : Collector-2.0.0, AddOnForQt-3.9.6
1-Win7 Business Pack1 64bits : wx-3.2.4, gcc-8.1.0,
2-OpenSuse::Leap-15.4-64bits : wx-3.2.4;gtk3, gcc-8.2.1,
=> !! The messages are translated by Deepl