Q:

PyQt Combobox add function to items

How can I add functions to specific choices. I have a combobox with server choices
server 1
server 2
server 3

I also have a button, what I want to do is when a user selects one of the servers, for example, if he selects server 1, when the user presses the button, the button signals a mysql database to download data. I know how to do the signals but what i dont understant is how to connect the options of the combobox to the button so that i can download the correct server data.
Combobox Code:
import sys
from PyQt4 import QtGui, QtCore

class server(QtGui.QWidget):
    """
    An basic example combo box application
    """

    def __init__(self):
        QtGui.QMainWindow.__init__(self)
        self.setWindowTitle('server')
        # Set the window dimensions
        self.resize(250,50)

        self.vbox = QtGui.QVBoxLayout()
        self.setLayout(self.vbox)

        self.combo = QtGui.QComboBox()
        self.vbox.addWidget(self.combo)

        self.combo.addItem('server1')
        self.combo.addItem('server2')
        self.combo.addItem('server3')

if __name__ == "__main__":
    app = QtGui.QApplication(sys.argv)
    gui = server()
    gui.show()
    app.exec_()

A:

First, there are new style signal/slot connections. Instead of
self.connect(self.combo, QtCore.SIGNAL('activated(QString)'), self.combo_chosen)

you can do
self.combo.activated.connect(self.combo_chosen)

But you don't need to connect to combo's signals for your task.

I also have a button, what I want to do is when a user selects one of
  the servers, for example, if he selects server 1, when the user
  presses the button, the button signals a mysql database to download
  data.

Connect to your button clicked signal. In the signal handler check your combo selected option and take the corresponding action.

