I'm trying to pass a name from a ComboBox to a MySQL search function, but no matter how I twist it, the get() always returns the first value in the combobox list, regardless of which name the user selects. Any ideas why? ComboBox Window - import search
-
-
def match():
-
#Initialize
-
new2 = tk.Toplevel()
-
new2.title("Matching Students and Projects")
-
title = tk.Label(new2, text = "See Student/Project matches for:", font=("Arial", 12, "bold"))
-
title.grid(row=0, column=0, sticky=W)
-
-
#Create drop-down list of students
-
students = ['student name', 'Student Name', 'Students Named']
-
-
Pmw.initialise()
-
studentmenu = Pmw.ComboBox(new2, label_text='Choose a Student:', labelpos = 'nw', scrolledlist_items=students, selectioncommand=None, entryfield_value=students[0])
-
studentmenu.grid(row=1, column=0, sticky=W, padx=0, pady=5)
-
-
#run the search
-
close = tk.Button(new2,text="Match",command=search.search(studentmenu))
-
close.grid(row=2, column=0)
-
-
#Exit
-
close = tk.Button(new2,text="Close Form",command=new2.destroy)
-
close.grid(row=2, column=0, sticky=W)
-
new2.mainloop()
Beginning of Search function - def search(menu):
-
#Select the student
-
searchname = menu.get()
-
searchname = searchname.split()
-
print searchname
-
fname = searchname[0]
-
lname = searchname[1]
1 14291
I would think it should be...
searchname = menu.getSelected()
Just a thought.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Zlatko Matić |
last post by:
There is a form (single form) and a combobox. I want that current record of
the form is adjusted according to selected value in the combobox. Cuurrent
record should be the same as the value in the...
|
by: Beeeeeeeeeeeeves |
last post by:
I have an ownerdrawn combo box which I am drawing with an image and some text, this is all working beautifully apart from the difference in the Brush I have to draw the background and the text with...
|
by: charliewest |
last post by:
Using .Net CF, i have created a 2 dimension ArrayList, and "binded" this list
to a ComboBox control using the "DataSource" property. I have set the
DisplaySource and ValueMember properties as well....
|
by: Doug |
last post by:
This is a repost of an item that I still cannot resolve.
I have 3 combo boxes. The first leads to the second to the third.
When I have selected a value in the second box, the third box shows...
|
by: Michael Turner |
last post by:
Hi I am having a problem with a combobox the values are generated from a
recordset, I need to beable to change the selected item to the value
specified in a configuration file, I have stored the...
|
by: jon f kaminsky |
last post by:
Hi-
I've seen this problem discussed a jillion times but I cannot seem to
implement any advice that makes it work. I am porting a large project from
VB6 to .NET. The issue is using the combo box...
|
by: shumaker |
last post by:
I have a combobox that is very much like the one found in the RSS
project here:
http://msdn.microsoft.com/vstudio/express/visualCSharp/learning/
My projectNameComboBox basically is filled with a...
|
by: kishorkumar |
last post by:
I have created a User control in my project.. added Combobox to that User control with some textitems inside that... this User control is added to a winform.. Now when i click on a button in the...
|
by: Frinavale |
last post by:
This question is going to sound a little crazy but.........How do you set the selected item in a ComboBox?
I am populating a ComboBox with a bunch of instances of a custom private class:
For...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |