So I am writing an irc chat bot with a pygtk gui. This bot has its gui running on a loop in the main script. When I press a button on the gui it starts a thread which opens a socket and connect to a irc channel, when I press it again it pauses the thread, and when I press it yet again it resumes the thread.
Until here all good.
But I want it to when I press a button in the gui (main loop) to read a text box and tell the thread to send the text through the irc connection.
My problem is I can't get the main loop to tell the thread to send the text. I tried something like(to test it out):
def botSendMessage(button):
thread.sendMessage(irc, "test")
handlers = {
"on_bot_send_button_clicked": botSendMessage,
}
builder.connect_signals(handlers)
I was alredy able to achieve what I was looking for. I used global variables.