Python

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • wxPython + signals

    3 answers - 1098 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Message
    From: J Kareta [mailto:python (AT) kareta (DOT) de]
    Sent: 25, 2006 7:52 AM
    To: wxPython-users (AT) lists (DOT) wxwidgets.org
    Subject: Re: [wxPython-users] wxPython + signals
    Jorgen Bodde schrieb:
    Hi all,
    I am searching for something like SigSlot (the C++'s counterpart). The
    main idea is that I want to make a data model that pushes messages /
    signals to my wxPython application. This way the GUI will
    Is there something like this in (wx)Python ? I saw that PyQT has it's
    signslot implementation but it should be more generic I guess
    Regards,
    - Jorgen
    look up pydispatcher:
    *pydispatcher*.sourceforge.net
    Regards,
    J
    , use wx.lib.pubsub, same idea but different way of doing it. In particular, pubsub allows for a hierarchy of message "topics", which I have found to be of great use in making the GUI "dumb".
    To unsubscribe, e-mail: wxPython-users-unsubscribe (AT) lists (DOT) wxwidgets.org
    For additional commands, e-mail: wxPython-users-help (AT) lists (DOT) wxwidgets.org
  • No.1 | | 1761 bytes | |

    Hi Peter and ,

    I would if I could. I am pretty new to (wx)Python so I am not aware of
    it's possibilities and built in solutions. sigslot appealed to me
    because I strongly believe in data model / GUI seperation. My previous
    apps became monsters because the GUI did more with the objects then
    plain behavioral code.

    My new vision is this:

    Controller - that can take actions like "create new project"

    Data - The project info itself

    GUI - As minimalistic as possible, should only respond to the data
    events or initialize new ones. I give a new "project" to the
    controller like;

    __controller.AddProject(new Project('my name'))

    It should emit events to the GUI where the "dumb" combobox simply adds
    the new project, the status bar shows this project if the
    ProjectManager object tells me that the new object added is also the
    selected on, etc.

    The problem with traditional GUI programming is that too much
    dependencies can exist, things can be forgotten to be updated, etc.

    This new approach can also allow Undo / Redo much easier as the Add
    signal can be replaced by a remove, which will hide the object from
    the GUI's again.

    To come back to the example, I am not knowledgeable enough to see how
    it works, nor can I see if it allows me to specify an argument list
    for every signal that I can create.

    By the way I tried PyDispatcher but there is almost no example to be
    found showing how it works. Anybody have a good example?
    - Jorgen

    To unsubscribe, e-mail: wxPython-users-unsubscribe (AT) lists (DOT) wxwidgets.org
    For additional commands, e-mail: wxPython-users-help (AT) lists (DOT) wxwidgets.org
  • No.2 | | 788 bytes | |

    "Jorgen Bodde" <jorgen.maillist (AT) gmail (DOT) comwrote:
    By the way I tried PyDispatcher but there is almost no example to be
    found showing how it works. Anybody have a good example?

    Try wx.lib.pubsub . It is significantly easier to understand

    topic = 'sample.topic'
    data = 'sample data'

    def printer(message):
    print message.topic, message.data

    import wx.lib.pubsub as ps

    ps.Publisher.subscribe(printer, topic)
    ps.Publisher.sendMessage(topic, data)
    ('sample', 'topic') sample data

    - Josiah

    To unsubscribe, e-mail: wxPython-users-unsubscribe (AT) lists (DOT) wxwidgets.org
    For additional commands, e-mail: wxPython-users-help (AT) lists (DOT) wxwidgets.org
  • No.3 | | 1271 bytes | |

    >
    By the way I tried PyDispatcher but there is almost no example to be
    found showing how it works. Anybody have a good example?

    Hi Jorgen,

    the example and test directory is lost in the current pydispatcher version 2.0.0
    (accidently I hope). But the older version 1.0.2 has the example. I attached the
    example to this mail for your convinience. I've tested pydispatcher some time
    ago with a simple gauge, witch is also attached. It was a quick and dirty try,
    that should give you a starting point, but otherwise don't take it too seriously
    ;-)

    By the way, I prefer pydispatcher over the wx solution, because it is gui
    independent and you can pass around every kind of data you can imagine.

    Just run frame.py and click the button. Inside frame.py some dispatcher.send
    calls are triggered, witch update the gauge in gauge.py. The dispatcher.send
    method could of course also be triggered in a normal python script without any
    gui modules imported.

    J

    Versandt durch den Webmaildienst der LDC GmbH Bonn

    To unsubscribe, e-mail: wxPython-users-unsubscribe (AT) lists (DOT) wxwidgets.org
    For additional commands, e-mail: wxPython-users-help (AT) lists (DOT) wxwidgets.org

Re: wxPython + signals


max 4000 letters.
Your nickname that display:
In order to stop the spam: 9 + 8 =
QUESTION ON "Python"

EMSDN.COM