[Glade-users] simulator_callbacks file
- From: paskari007 at yahoo.ca (Peyman)
- Subject: [Glade-users] simulator_callbacks file
- Date: Wed, 4 Mar 2009 19:59:35 +0000
I found a way to deal with this, which is based in part on your advice
I made a file called globalVars.py, and I put all the variables in
there, and put them in immutable objects when necessary. So, for
example, integers and strings I nested inside of lists.
This has so far solved my problem.
On 4 Mar 2009, at 07:20, Juan Manuel Mouriz wrote:
Mmmm... I can not think how to do it without C types because Python
does not support pointers. Here an example:
juan at pituca:~/globals$ cat globals.py
from ctypes import *
message = c_char_p("salute")
juan at pituca:~/globals$ cat test1.py
from globals import *
from ctypes import *
def f1():
global message
message.value = "hello"
juan at pituca:~/globals$ cat test2.py
from globals import *
from ctypes import *
def f2():
global message
message.value = message.value + " world"
juan at pituca:~/globals$ cat sample.py
from test1 import *
from test2 import *
from globals import *
print message.value
f1()
print message.value
f2()
print message.value
juan at pituca:~/globals$ python sample.py
salute
hello
hello world
-----Mensaje original-----
De: Peyman <paskari007 at yahoo.ca>
Para: jmouriz at slowsoft.com.ar
Asunto: Re: [Glade-users] simulator_callbacks file
Fecha: Wed, 4 Mar 2009 01:17:20 +0000
Hello
I tried that, but how do I get around sharring global variables? For
example if callback_1(*args) in callbacks1.py and callback_4(*args) in
callbacks2.py both have to update the global variable time
Cheers
peyman askari
On 4 Mar 2009, at 01:14, Juan Manuel Mouriz wrote:
In callbacks1.py:
def callback_1(*args):
pass
def callback_2(*args):
pass
def callback_3(*args):
pass
In callbacks2.py:
def callback_4(*args):
pass
def callback_5(*args):
pass
def callback_6(*args):
pass
Then in your program:
from callbacks1 import *
from callbacks2 import *
callback_1()
callback_6()
-----Mensaje original-----
De: Peyman <paskari007 at yahoo.ca>
Para: glade-users <glade-users at lists.ximian.com>
Asunto: [Glade-users] simulator_callbacks file
Fecha: Wed, 4 Mar 2009 00:49:27 +0000
Hi
I've developed my glade project, and my python files are rather
numerous. Where glade comes in is that it creates two files for me
A simulator.py file launches the GUI
A simulator_callbacks.py file has all of the callbacks of the
widgets
The problem is that the simulator_callbacks.py file is HUGE. I would
like to split it up but I don't know how. Any help would be
appreciated.
Cheers
Peyman Askari
_______________________________________________
Glade-users maillist - Glade-users at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/glade-users
--
Juan Manuel Mouriz
Desarrollo de software moderado
http://www.slowsoft.com.ar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/glade-users/attachments/20090304/81086707/attachment.html
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]