Hi!
I want to call tcl from python and python from tcl. The big picture is
that I´m writing an application GUI with tcl/tk and application logic
with python, so at least I want to call python events from the tk GUI.
I have read about _tkinter and tkapp.call although I couldn´t find any
detailed documentation. And, anyway, that seems to work in one
direction (python->tcl) but I don´t know how to make it work in the
other (tcl->python).
Thank you,
Carlos 4 7305
Carlos P. wrote: Hi! I want to call tcl from python and python from tcl. The big picture is that I´m writing an application GUI with tcl/tk and application logic with python, so at least I want to call python events from the tk GUI. I have read about _tkinter and tkapp.call although I couldn´t find any detailed documentation. And, anyway, that seems to work in one direction (python->tcl) but I don´t know how to make it work in the other (tcl->python). Thank you, Carlos
Hello,
I have found an hint in the Tcl Wiki about Tclpython: http://mini.net/tcl/5630
May be this will help you a little.
Gerard Sookahet
funny -- first look at the board and it's right on subject.
I'm trying to write an app that does some cool stuff with sound
samples, using tkSnack. But I'm stuck on a simple question -- how do
I insert some of my own code into the tkInter mainloop? I need the
sequencer to run in the background while the UI is up.
Forgetting about snack for the moment, how do I run _any_
non-event-driven code while my Tk widgets are active? (for instance,
animation in one window while menus are still available). I can't
find any demos that show this sort of behavior.
All the Tk examples I've seen set up the widgets and run
root.mainloop() . I can't for the life of me figure out what code this
call invokes, but it won't return until a quit command or some such
action is initiated by the user. TCL docs say that Tk_mainloop calls
tcl_DoOneEvent( ) in a dead loop until a quit flag is set, or something
like that.
My best guess is that I'm supposed to set up another thread to do my
stuff, and send messages to the Tkinter thread that trigger Tk events,
or something like that. But the Tkinter docs are so sketchy I can't
really get a handle on how to do it. Any help or pointers would be
appreciated.
thanks in advance - stumped cp*****@yahoo.c om.ar (Carlos P.) wrote in message news:<45******* *************** ****@posting.go ogle.com>... Hi! I want to call tcl from python and python from tcl. The big picture is that I´m writing an application GUI with tcl/tk and application logic with python, so at least I want to call python events from the tk GUI. I have read about _tkinter and tkapp.call although I couldn´t find any detailed documentation. And, anyway, that seems to work in one direction (python->tcl) but I don´t know how to make it work in the other (tcl->python). Thank you, Carlos
In article <fb************ **************@ posting.google. com>,
dan <da*******@yaho o.com> wrote: funny -- first look at the board and it's right on subject.
I'm trying to write an app that does some cool stuff with sound samples, using tkSnack. But I'm stuck on a simple question -- how do I insert some of my own code into the tkInter mainloop? I need the sequencer to run in the background while the UI is up.
Forgetting about snack for the moment, how do I run _any_ non-event-driven code while my Tk widgets are active? (for instance, animation in one window while menus are still available). I can't find any demos that show this sort of behavior.
All the Tk examples I've seen set up the widgets and run root.mainloop( ). I can't for the life of me figure out what code this call invokes, but it won't return until a quit command or some such action is initiated by the user. TCL docs say that Tk_mainloop calls tcl_DoOneEvent () in a dead loop until a quit flag is set, or something like that.
My best guess is that I'm supposed to set up another thread to do my stuff, and send messages to the Tkinter thread that trigger Tk events, or something like that. But the Tkinter docs are so sketchy I can't really get a handle on how to do it. Any help or pointers would be appreciated.
You can convert your code so that it runs from callbacks
(after/after_idle), or so that it calls the Tk event handler at reasonable
intervals. The first approach means greatly changing your code (though
you may be able to abuse generator functions here), and the second
approach means that a few Tk things will interact badly with your fake
mainloop (tk_wait). Threading is another possibility, but it's
problematic with Tk because you must make sure all Tk calls happen in
only one thread (the main thread, I think; or maybe the thread that
created the Tk instance)
Jeff This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: nik |
last post by:
hi,
my C++ app has embedded the interpreter and calls a python script
everytime it creates a certain data structure. This allows the user to
put the structure into a database or files or whatever. For example;
// Py_Initialize(); has been called earlier
m_module = PyImport_AddModule("myModule");
// for example, this string is my data structure
|
by: Travis Berg |
last post by:
I'm running into a problem when trying to perform a callback to a Python
function from a C extension. Specifically, the callback is being made by
a pthread that seems to cause the problem. If I call the callback from
the parent process, it works fine. The PyObject is static, and holds the
same value in both Parent and thread, so I'm at a loss as to what would be
different in the pthread from the parent that would cause a segfault on
the...
|
by: Stephen Kellett |
last post by:
Hello everyone,
I'm trying to do something in C calling Python and its failing. I'd be
grateful if you could take a look and hopefully you have an answer.
What I'm trying to do is determine the address of the "collect" function
in the "gc" module. I want to do this so that we can determine when a
garbage collection happens, regardless of how it is triggered
(explicitly by a user call, or implicitly by the behaviour of the
program...
|
by: soumitra.mishra |
last post by:
Hi All,
I want to call (execute) some python scripts from my C# program. I know
that this can be done but have not idea how. The other option that I
can think of is developing python web services and then calling them
from from C# program. I just wanted to know what is the best option and
how it can be achieved. In the end all I want is to trigger some python
scripts from my C# code. The is NO remote execution involved here
therefore I...
|
by: Mr BigSmoke |
last post by:
Hi everybody,
I need write an application in c#, but i wnat to use some functions
that i have already written in python. Is there an "easy" way to call
my python code from c#? I must use COM or there are other ways? And, if
COM is the only way, where can i find some tutorials or examples? I've
never wrote com server and i really don't know where and how to
start....
tnx
Fabio
| |
by: Carl |
last post by:
I am desperately looking for a way to call Python from Matlab. I have become
used to Python's rich syntax and large number of libraries, and feel
ridiculously clumsy being stuck with Matlab's rather restricted facilities
for doing other things than standard mathematical work.
Does anyone know of good techniques (or readily available software) for
achieving a cross-language support between Python and Matlab?
Carl
|
by: jvframework |
last post by:
I have a C# .NET cliente calling a Python web services. I pass two
string values to web service and I wanna receive a string from the
method.
But, the server side receive my string values and the client side only
display a empty string ("").
I generate a C# Proxy class from the python web services WSDL with
wsdl.exe tool.
|
by: varuns |
last post by:
if i need to call a python function from c, i can use PyImport _Import()
python-c API. Following code shows calling python function "add1" from python module "def1"
int add(int x, int y)
{
double answer;
Py_Initialize();
PyObject *modname, *mod, *mdict, *func, *arg1, *arg2, *args, *rslt;
printf("############INSIDE ADD############\n");
modname = PyString_FromString("def1");
if (modname == NULL)
|
by: Martin Rubey |
last post by:
Dear all,
I'm trying to call from common lisp functions written for Sage
(www.sagemath.org), which in turn is written in python. To do so, I tried
http://common-lisp.net/project/python-on-lisp/. It was quite easy to get it to
run and do some simple things with python.
However, I was unable to get sage to run within it.
If I start my local python 2.5 and follow (roughly)
|
by: Catherine Moroney |
last post by:
I have one script (Match1) that calls a Fortran executable as a
sub-process, and I want to write another script (Match4) that
spawns off several instances of Match1 in parallel and then waits
until they all finish running. The only way I can think of doing this
is to call it as a sub-process, rather than directly.
I'm able to get Match1 working correctly in isolation, using the
subprocess.Popen command, but calling an instance of Match1...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |