wx.lib.pubsub (Pubsub)

Hmm,

I replaced the hide call with variations of close and destroy on the panel as well as the popup frame. The issue still persists. I am unsure as to what is going on. I verified that the frame did indeed close but the program still continues to run upon exit.

Josh

···

On Monday, July 2, 2012 5:34:34 PM UTC-4, jskoeh9 wrote:

Hi all,

I am trying to use pubsub to send data back to my main frame from a popup frame upon a button press. The button press hides the popup panel and then sends a message to the main frame via pubsub.

The data is successfully transferred. However, when I exit the GUI, python continues to run as if not all of the windows have closed. When I comment out the pubsub command, press the button, and try to close, the program successfully exits. It is only with the pubsub command that the GUI does not exit completely.

Here is the sending portion of the code:

def OnGenerate(self, event):

Get type of graph user selected

self.type = self.lb_choose_type.GetStringSelection()

if self.type == “Balanced Tree”:

factor = int(self.txt_branch_factor.GetValue())

height = int(self.txt_height.GetValue())

self.G = nx.balanced_tree(factor, height)

self.parent.Show(False)

self.parent.Centre()

Publisher.sendMessage((“Data Generated”))

and the receiving panel:

Publisher.subscribe(self.GetData, (“Data Generated”))

The popup consists of a panel in a “fake popup frame.” This frame’s parent is the main frame.

Any insight as to why the GUI would not close successfully with Pubsub would be much appreciated.

I am running OSX 10.6.8, python 2.7, and wxPython 2.8.12.1.

Thank you

Josh

Hmm,

I replaced the hide call with variations of close and destroy on the panel as well as the popup frame. The issue still persists. I am unsure as to what is going on. I verified that the frame did indeed close but the program still continues to run upon exit.

Josh

Josh, it is very unlikely that pubsub is preventing this (it only keeps week references to listeners). When you say “comment out the pubsub command” do you mean the sendMessage? Are you passing any data in the pubsub sendMessage that might use reference to data in your panel? It appears you are using the deprecated pubsub API, can you try with the maintained one? Have you tried the unsubscribeAll() in your close method? This call should not be required but I have heard of a couple cases when it seems to help, never had time to look into the reason.

···

On Tue, Jul 3, 2012 at 7:20 AM, jskoeh9 jskoeh9@terpmail.umd.edu wrote:

On Monday, July 2, 2012 5:34:34 PM UTC-4, jskoeh9 wrote:

Hi all,

I am trying to use pubsub to send data back to my main frame from a popup frame upon a button press. The button press hides the popup panel and then sends a message to the main frame via pubsub.

The data is successfully transferred. However, when I exit the GUI, python continues to run as if not all of the windows have closed. When I comment out the pubsub command, press the button, and try to close, the program successfully exits. It is only with the pubsub command that the GUI does not exit completely.

Here is the sending portion of the code:

def OnGenerate(self, event):

Get type of graph user selected

self.type = self.lb_choose_type.GetStringSelection()

if self.type == “Balanced Tree”:

factor = int(self.txt_branch_factor.GetValue())

height = int(self.txt_height.GetValue())

self.G = nx.balanced_tree(factor, height)

self.parent.Show(False)

self.parent.Centre()

Publisher.sendMessage((“Data Generated”))

and the receiving panel:

Publisher.subscribe(self.GetData, (“Data Generated”))

The popup consists of a panel in a “fake popup frame.” This frame’s parent is the main frame.

Any insight as to why the GUI would not close successfully with Pubsub would be much appreciated.

I am running OSX 10.6.8, python 2.7, and wxPython 2.8.12.1.

Thank you

Josh

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

Ah,

That was the problem. There was a reference to an attribute of the popup panel that the frame received. If I wanted to have the frame still access that attribute, what would be the best way to go about that?

Thanks!

Josh

···

On Tuesday, July 3, 2012 10:02:51 AM UTC-4, scholli wrote:

On Tue, Jul 3, 2012 at 7:20 AM, jskoeh9 jskoeh9@terpmail.umd.edu wrote:

Hmm,

I replaced the hide call with variations of close and destroy on the panel as well as the popup frame. The issue still persists. I am unsure as to what is going on. I verified that the frame did indeed close but the program still continues to run upon exit.

Josh

Josh, it is very unlikely that pubsub is preventing this (it only keeps week references to listeners). When you say “comment out the pubsub command” do you mean the sendMessage? Are you passing any data in the pubsub sendMessage that might use reference to data in your panel? It appears you are using the deprecated pubsub API, can you try with the maintained one? Have you tried the unsubscribeAll() in your close method? This call should not be required but I have heard of a couple cases when it seems to help, never had time to look into the reason.

On Monday, July 2, 2012 5:34:34 PM UTC-4, jskoeh9 wrote:

Hi all,

I am trying to use pubsub to send data back to my main frame from a popup frame upon a button press. The button press hides the popup panel and then sends a message to the main frame via pubsub.

The data is successfully transferred. However, when I exit the GUI, python continues to run as if not all of the windows have closed. When I comment out the pubsub command, press the button, and try to close, the program successfully exits. It is only with the pubsub command that the GUI does not exit completely.

Here is the sending portion of the code:

def OnGenerate(self, event):

Get type of graph user selected

self.type = self.lb_choose_type.GetStringSelection()

if self.type == “Balanced Tree”:

factor = int(self.txt_branch_factor.GetValue())

height = int(self.txt_height.GetValue())

self.G = nx.balanced_tree(factor, height)

self.parent.Show(False)

self.parent.Centre()

Publisher.sendMessage((“Data Generated”))

and the receiving panel:

Publisher.subscribe(self.GetData, (“Data Generated”))

The popup consists of a panel in a “fake popup frame.” This frame’s parent is the main frame.

Any insight as to why the GUI would not close successfully with Pubsub would be much appreciated.

I am running OSX 10.6.8, python 2.7, and wxPython 2.8.12.1.

Thank you

Josh

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

Just send the data, not the reference in the pubsub message. If you need to update from time to time, use wx.Timer to poll it and grab the data.

  • Mike
···

On Tuesday, July 3, 2012 9:56:41 AM UTC-5, jskoeh9 wrote:

Ah,

That was the problem. There was a reference to an attribute of the popup panel that the frame received. If I wanted to have the frame still access that attribute, what would be the best way to go about that?

Thanks!

Josh

Ah,

That was the problem. There was a reference to an attribute of the popup panel that the frame received. If I wanted to have the frame still access that attribute, what would be the best way to go about that?

Thanks!

Josh

Glad that worked. You could set the reference to nil, that should allow the garbage collector to also release the panel.

Oliver

···

On Tue, Jul 3, 2012 at 10:56 AM, jskoeh9 jskoeh9@terpmail.umd.edu wrote:

On Tuesday, July 3, 2012 10:02:51 AM UTC-4, scholli wrote:

On Tue, Jul 3, 2012 at 7:20 AM, jskoeh9 jskoeh9@terpmail.umd.edu wrote:

Hmm,

I replaced the hide call with variations of close and destroy on the panel as well as the popup frame. The issue still persists. I am unsure as to what is going on. I verified that the frame did indeed close but the program still continues to run upon exit.

Josh

Josh, it is very unlikely that pubsub is preventing this (it only keeps week references to listeners). When you say “comment out the pubsub command” do you mean the sendMessage? Are you passing any data in the pubsub sendMessage that might use reference to data in your panel? It appears you are using the deprecated pubsub API, can you try with the maintained one? Have you tried the unsubscribeAll() in your close method? This call should not be required but I have heard of a couple cases when it seems to help, never had time to look into the reason.