title: Calling a function without the button click event
body: <p>I am trying to call 2 functions with the Button Press and Relase events.
  When I am calling same function without these events (directly in my code), they are not giving desired output.</p>
  
  <p>When I click "Connect Button":</p>
  
  <ul>
  <li>On Button Press Event -> Call Function connect (which will create a connection between Client and Server)</li>
  <li>On Button Release Event -> Call Function Send Details (which will send data from client to server)</li>
  </ul>
  
  <p>When I used print command to check the flow of program, I found that <code>connection.transport.write(data)</code> is creating issue.</p>
  
  <pre><code>def on_connectCLB_pressed(self):
      Connect()
  
  def on_connectCLB_released(self):
      Send_Details()
  
  
  def Send_Details():
      print "Send_Details"
      global connection,chat
      contents="contents"
      if (USER!=''):
          stat="Available"
          data="user_details&gt;&gt;:"+USER +"&gt;&gt;:"+stat+"&gt;&gt;:"+contents
          connection.transport.write(data)
      else:
          GUI.setStatusTip(QtGui.QApplication.translate("MainWindows", 'Enter your username.', None, QtGui.QApplication.UnicodeUTF8))
  
  def Connect():
      print "Connect"
      global connection
      connection=reactor.connectTCP(HOST,int(PORT) , EchoClientFactory()) ##listenTCP and connectTCP,to set defaults for all connections coming from that accept() or connect()
  </code></pre>