473,398 Members | 2,188 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Combobox get() not returning selected value

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
Expand|Select|Wrap|Line Numbers
  1. import search
  2.  
  3. def match():
  4.     #Initialize
  5.     new2 = tk.Toplevel()
  6.     new2.title("Matching Students and Projects")
  7.     title = tk.Label(new2, text = "See Student/Project matches for:", font=("Arial", 12, "bold"))
  8.     title.grid(row=0, column=0, sticky=W)
  9.  
  10.     #Create drop-down list of students
  11.     students = ['student name', 'Student Name', 'Students Named']
  12.  
  13.     Pmw.initialise()
  14.     studentmenu = Pmw.ComboBox(new2, label_text='Choose a Student:', labelpos = 'nw', scrolledlist_items=students, selectioncommand=None, entryfield_value=students[0])
  15.     studentmenu.grid(row=1, column=0, sticky=W, padx=0, pady=5)
  16.  
  17.     #run the search
  18.     close = tk.Button(new2,text="Match",command=search.search(studentmenu))
  19.     close.grid(row=2, column=0)
  20.  
  21.     #Exit
  22.     close = tk.Button(new2,text="Close Form",command=new2.destroy)
  23.     close.grid(row=2, column=0, sticky=W)
  24.     new2.mainloop()
Beginning of Search function
Expand|Select|Wrap|Line Numbers
  1. def search(menu):
  2.     #Select the student
  3.     searchname = menu.get()
  4.     searchname = searchname.split()
  5.     print searchname
  6.     fname = searchname[0]
  7.     lname = searchname[1]
Jul 7 '09 #1
1 14291
Silgd1
25
I would think it should be...

searchname = menu.getSelected()
Just a thought.
Jul 10 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

8
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...
4
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...
7
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....
0
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...
4
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...
4
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...
2
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...
0
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...
11
Frinavale
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
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...
1
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...
0
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...
0
marktang
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,...
0
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...
0
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...
0
tracyyun
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...
0
agi2029
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.