views:

35

answers:

0

so heres whats up. I'm making a little program for myself that 1)takes a name of a row from a drop down box and makes a query with it and 2) displays query results into a multi-column list. i have the gui setup i need to sript the drop box with the query names and then have the results go into the list i set up in the gui

heres the code

from PythonCard import dialog ,model
import os
import MySQLdb

class CheatLookup(model.Background):
    def on_initialize(self, event):
        conn = MySQLdb.connect (host = "127.0.0.10",
                                user = "root",
                                passwd = "366387",
                                db = "my_project")


     def on_Cancel_mouseClick(self, event):
        self.close()

    def on_Go_mouseClick(self, event):
        cursor = connection.cursor()
        cursor.execute( "SELECT * from cheats" )
        authorList = cursor.fetchall()

if __name__=="__main__":
     app=model.Application(CheatLookup)
     app.MainLoop()

and heres the resource

{'application':{'type':'Application',
      'name':'Template',
'backgrounds': [
{'type':'Background',
      'name':'bgTemplate',
      'title':'Standard Template with File->Exit menu',
      'size':(540, 450),
      'style':['resizeable'],

    'menubar': {'type':'MenuBar',
     'menus': [
         {'type':'Menu',
         'name':'menuFile',
         'label':'&File',
         'items': [
              {'type':'MenuItem',
               'name':'menuFileExit',
               'label':'E&xit',
               'command':'close',
              },
          ]
         },
     ]
 },
     'components': [

{'type':'MultiColumnList', 
'name':'Codes', 
'position':(21, 71), 
'size':(333, 201), 
'backgroundColor':(255, 255, 255, 255), 
'columnHeadings':[], 
'font':{'faceName': u'Tahoma', 'family': 'sansSerif', 'size': 8}, 
'items':[], 
'maxColumns':20, 
'rules':1, 
},

{'type':'Button', 
'name':'Cancel', 
'position':(96, 38), 
'label':'Cancel', 
},

{'type':'Button', 
'name':'Go', 
'position':(13, 38), 
'label':'Go', 
},

{'type':'ComboBox', 
'name':'ComboBox1', 
'position':(25, 8), 
'items':[], 
},

] # end components
} # end background
] # end backgrounds
} }