So far everything is working correctly, however I am struggling with getting the data below, once highlighted by the mouse and once hitting the select button to populate the correct entry boxes. This may be asking too much.
Listbox display
2-12312 Bob Seesaw Active
4-1212 Jim Beene Off
So if I highlight the Bob Seesaw row and hit select. The 2-12312 will pretype 'num_input', Bob 'nam_input' and so on. The purpose of this is so I can then type a new assignment and update the database for that entry. ( I pasted code specific to my initiative.
from tkinter import *
import pymysql as mdb
from tkinter import ttk
from tkinter import Listbox
def viewroster():
rosterList.delete(0, "end")
dbi = mdb.connect("localhost", port=3306, user="user", passwd="pass", db="interactive_db")
cursor = dbi.cursor()
cursor.execute("""SELECT number, firstname, surname, assign FROM active_roster""")
rows=cursor.fetchall()
dbi.close()
print (rows)
for results in rows:
rosterList.insert("end", results)
#Input Fields
num_input=StringVar()
num_input=Entry(root,textvariable=num_input)
num_input.grid(row=0,column=1)
ass_input=StringVar()
ass_input=Entry(root,textvariable=ass_input)
ass_input.grid(row=0,column=3)
nam_input=StringVar()
nam_input=Entry(root,textvariable=nam_input)
nam_input.grid(row=1,column=1)
sur_input=StringVar()
sur_input=Entry(root,textvariable=sur_input)
sur_input.grid(row=1,column=3)
# This is to select mouse highlighted data
rosSelButt=Button(root, text="Select", width=12)
rosSelButt.grid(row=13, column=0)
-
Number [2-12312]
Firstname [Bob] Surname [Seesaw] Assign [......] (ready for text)
I do not want to loose the capability of typing a name or number as an entry and searching the database.

<<ListboxSelect>>will execute function in which you have to copy selected data fromListboxtoEntriesmanually.