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 14343
I would think it should be...
searchname = menu.getSelecte d()
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 combobox.
What is the solution?
Thank you in advance.
|
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 if the item is the currently selected one.
I have selected a blue (SystemColors.Highlight) background brush and white (SystemColors.HighlightText) text brush if the item is the highlighted one, but when I do that instead of functioning like a...
|
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. The control populates well,
both the display values, and selected values.
However, when i try to "set" the SelectedValue or SelectedIndex properties,
nothing happens.... The default blank value in the ComboBox is always
selected. My code is:
...
|
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 the
available information based on the second combo box selection. But if I
change my mind and select a different item in the second box, after the
third box has been populated, the third box still retains the information
that was previously...
|
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 value as a varible. I
am using the code below but it isn't working any ideas am I using the right
method.
combobox1.selecteditem = getcolvalue(0)
Any help appreciated.
| |
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 bound to a table as a lookup,
drawing values from another table to populate the available selections. This
all worked fine in VB6.
I have distilled the problem down to a simple form drawing data from the
Northwind database for a representative...
|
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 list of values from a
table, and as the user selects values, a datagrid displays related
records from another table because it is bound via FK relationship.
My table:
/****** Object: Table . Script Date: 06/19/2006
|
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 form i want to get that selected item from that combobox..
but the problem now is i am using properties but it is returning a null value ..
Please let me know if anybody can get a solution to this..
|
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 Each s as Something In MyListOfSomethings
MyComboBox.Items.Add(New XYZListItem(s.ID,s.description))
Next
MyComboBox.ValueMember = "ID"
MyComboBox.DisplayMember = "Description"
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |