I have client server program. My python always listens to the data passed in the socket. If I get certain predefined strings from the server i display a modal dialog.The dialog can be closed in 2 ways. First way is user should react to the dialog buttons. Second way is, From socket i have to receive one more command to close. Now problem i am facing is when the dialog is visible the socket doesn't receive any string. Only if I close the dialog the string sent by the client when dialog was there is received from the socket. How can i receive messages asyncronously from the client when dialog is there. If this is possible how do i close the dialog programatically.
Asked
Active
Viewed 217 times
0
-
Both your problems are linked to the usage of the modal dialog. You 'd better create a regular dialog (not modal) with only the "stay-on-top" attribute set. On that window you will be able to modify messages and even to close it from your other process, I think. – Louis Sep 05 '11 at 15:41
-
Hi louis, I tried doing it non modal but then the buttons dont send response signal – Shrikanth Kalluraya Sep 07 '11 at 11:40
1 Answers
1
Both your problems are linked to the usage of the modal dialog. You 'd better create a regular dialog (not modal) with only the "stay-on-top" attribute set. On that window you will be able to modify messages and even to close it from your other process.
You will have to add the "response" (or another method name if you want) to the buttons :
self.stayOnTopWindowResponse = None
b = gtk.Button("Accept")
b.response = "Accept"
b.connect("clicked", self.accepted)
and in the "accepted" routine (one for all the buttons) something like that:
def accepted(self, widget):
self.stayOnTopWindowResponse = widget.response
self.stayOnTopWindow.close()
I did not test this, but it should work.

Louis
- 2,854
- 2
- 19
- 24