Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 5

Qt-interest Archive, November 2007
Qt with Tcl/Tk


Message 1 in thread

Hello All,
 
I am implemelnting a command window in my application and want to
pluging Tcl/Tk interface as a command interpreter.
Does anyone has experience of such integration, if yes, please do share
your comments/experience.
 
Thnx
Prateek

Message 2 in thread

Prateek wrote:
> I am implemelnting a command window in my application and 
> want to pluging Tcl/Tk interface as a command interpreter.
> Does anyone has experience of such integration, if yes, 
> please do share your comments/experience.

i can't really help you with that, and never heard of anyone trying
this.

Instead, i'd like to point you here:
http://doc.trolltech.com/4.3/qtscript.html
Since 4.3, Qt offers a very powerful (ECMAScript) scripting language.
This is already fully integrated with Qt, and i bet you can save a lot
of time using this.

Cheers,
Peter

--
 [ signature omitted ] 

Message 3 in thread

Peter Prade wrote:

> Prateek wrote:
>> I am implemelnting a command window in my application and
>> want to pluging Tcl/Tk interface as a command interpreter.
>> Does anyone has experience of such integration, if yes,
>> please do share your comments/experience.
> 
> i can't really help you with that, and never heard of anyone trying
> this.
> 
> Instead, i'd like to point you here:
> http://doc.trolltech.com/4.3/qtscript.html
> Since 4.3, Qt offers a very powerful (ECMAScript) scripting language.
> This is already fully integrated with Qt, and i bet you can save a lot
> of time using this.

Just to make sure that all the options are on the table, you might also
want to take a look at Tq:

http://www.froglogic.com/pg?id=Products&category=tq&sub=overview

David
-- 
 [ signature omitted ] 

Message 4 in thread

TclInterpreter = Tcl_CreateInterp();

if(Tcl_Init(gTclInterpreter)== TCL_ERROR) {

gErrorStream << "Can not initialize Tcl interpreter.";

gTclInterpreter = NULL;

}



gTclInterpreter is a global TCl interpreter that u an use in ur application.Intialize Tcl in main and check whether the interpreter is initialized properly or not.Hope this will help u.

  ----- Original Message ----- 
  From: Prateek Tiwari 
  To: qt-interest@xxxxxxxxxxxxx 
  Sent: Wednesday, November 28, 2007 5:39 PM
  Subject: Qt with Tcl/Tk


  Hello All,

  I am implemelnting a command window in my application and want to pluging Tcl/Tk interface as a command interpreter.
  Does anyone has experience of such integration, if yes, please do share your comments/experience.

  Thnx
  Prateek

Message 5 in thread

On Wed, November 28, 2007 13:09, Prateek Tiwari wrote:
> I am implemelnting a command window in my application and want to
> pluging Tcl/Tk interface as a command interpreter.

So far it sounds simple: if you only want to type in commands for the
Tcl-Interpreter and then display the results, simply link libtcl,
initialize the interpreter (Tcl_Init) and call it (Tcl_Eval).

See your favourite Tcl-Documentation for details. (eg. http://wiki.tcl.tk)

> Does anyone has experience of such integration, if yes, please do share
> your comments/experience.

If you want more it could become much more complex, just a few points:

*Be careful with threads: Tcl accesses some global structures that easily
lead to crashes if more than one Thread runs a Tcl-Interpreter at the same
time. If you need that you must compile Tcl with thread support (off per
default).

*If you want to call back into the GUI: it might be much easier and more
flexible to just use QtScript. Tcl does not easily adapt to the Qt-way of
doing things. Integration needs considerable work, but is possible.

*It is nearly impossible to fully integrate the Qt- and Tcl-Eventloops.
You need to find a compromise if you need them.



    Konrad

--
 [ signature omitted ] 

Message 6 in thread

Konrad Rosenbaum schrieb:
> If you want more it could become much more complex, just a few points:
>
> *Be careful with threads: Tcl accesses some global structures that easily
> lead to crashes if more than one Thread runs a Tcl-Interpreter at the same
> time. If you need that you must compile Tcl with thread support (off per
> default).
>
> *If you want to call back into the GUI: it might be much easier and more
> flexible to just use QtScript. Tcl does not easily adapt to the Qt-way of
> doing things. Integration needs considerable work, but is possible.
>   

Or use Tq :-) See www.froglogic.com/tq

> *It is nearly impossible to fully integrate the Qt- and Tcl-Eventloops.
> You need to find a compromise if you need them.
>   

Tq offers exactly that. It even allows to embed Tk windows in Qt and
vice versa and much more.

-- 
 [ signature omitted ] 

Message 7 in thread

Thank You all for your comments!

R's
Prateek 

-----Original Message-----
From: Reginald Stadlbauer [mailto:reggie@xxxxxxxxxxxxx] 
Sent: Wednesday, November 28, 2007 7:19 PM
To: qt-interest@xxxxxxxxxxxxx
Subject: Re: Qt with Tcl/Tk

Konrad Rosenbaum schrieb:
> If you want more it could become much more complex, just a few points:
>
> *Be careful with threads: Tcl accesses some global structures that 
> easily lead to crashes if more than one Thread runs a Tcl-Interpreter 
> at the same time. If you need that you must compile Tcl with thread 
> support (off per default).
>
> *If you want to call back into the GUI: it might be much easier and 
> more flexible to just use QtScript. Tcl does not easily adapt to the 
> Qt-way of doing things. Integration needs considerable work, but is
possible.
>   

Or use Tq :-) See www.froglogic.com/tq

> *It is nearly impossible to fully integrate the Qt- and
Tcl-Eventloops.
> You need to find a compromise if you need them.
>   

Tq offers exactly that. It even allows to embed Tk windows in Qt and
vice versa and much more.

--
 [ signature omitted ]