so basically..what i have done is created a database, populated it and call that database from the GUI. When a user searches something in the database through the GUI, the result of the query displays next to the entry field. However, I need to display the results in a text field, for such instances where the results is really long. How do i do that? - from Tkinter import *
-
import analyse
-
-
-
-
def quit(window):
-
window.destroy()
-
-
def query1(db, entry, text_box):
-
text_box.insert(END, str(var.set(analyse.component_by_brand(db, entry.get()))))
-
#var.set(analyse.component_by_brand(db, entry.get()))
-
-
-
def query2(db, entry, var):
-
var.set(analyse.price_with_serial(db, entry.get()))
-
-
-
def query3(db, entry1, entry2, var):
-
var.set(analyse.type_with_both(db, entry1.get(), entry2.get()))
-
-
-
def run_analyse(db):
-
window = Tk()
-
-
frame = Frame(window)
-
frame.pack()
-
-
-
window.title(" Hardware Components")
-
q1_prompt = Label(frame, text="Enter a Brand:")
-
q1_prompt.grid(row=0, column=0)
-
q1_data = Entry(frame)
-
q1_data.grid(row=0, column=1)
-
q1_command = lambda : query1(db, q1_data, q1_var)
-
q1_button = Button(frame, text="Search for Type", command=q1_command)
-
q1_button.grid(row=0, column=2)
-
-
q1_var = StringVar()
-
q1_result = Label(frame, textvariable=q1_var)
-
q1_result.grid(row=0, column=3)
-
-
blank = Label(frame, text="")
-
blank.grid(row=1, columnspan=4)
-
-
q2_prompt = Label(frame, text="Enter the Serial Number:")
-
q2_prompt.grid(row=2, column=0)
-
q2_data = Entry(frame)
-
q2_data.grid(row=2, column=1)
-
q2_command = lambda : query2(db, q2_data, q2_var)
-
q2_button = Button(frame, text="Search for price", command=q2_command)
-
q2_button.grid(row=2, column=2)
-
q2_var = StringVar()
-
q2_result = Label(frame, textvariable=q2_var)
-
q2_result.grid(row=2, column=3)
-
-
blank2 = Label(frame, text="")
-
blank2.grid(row=3, columnspan=4)
-
-
q3_prompt = Label(frame, text="Enter the first part of the component:")
-
q3_prompt.grid(row=4, column=0)
-
q3_data = Entry(frame)
-
q3_data.grid(row=4, column=1)
-
q3_prompt2 = Label(frame, text="Enter the second part of the component:")
-
q3_prompt2.grid(row=5, column=0)
-
q3_data2 = Entry(frame)
-
q3_data2.grid(row=5, column=1)
-
q3_command = lambda : query3(db, q3_data, q3_data2, q3_var)
-
q3_button = Button(frame, text="Search for Name", command=q3_command)
-
q3_button.grid(row=5, column=2)
-
q3_var = StringVar()
-
q3_result = Label(frame, textvariable=q3_var)
-
q3_result.grid(row=5, column=3)
-
-
def text_box():
-
w = Text(frame)
-
w.grid(row=0,column=4, rowspan=13)
-
-
quit_button = lambda : quit(window)
-
b2 = Button(frame, text = "Quit", command = quit_button)
-
b2.grid(row=6, column=1)
-
-
window.mainloop()
1 2692
as you can see from my query1 function i tried the insert it into a text field but it wont work
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Jeroen van vliet |
last post by:
Hello
How can i run a query from a mdb database and show it in a datagrid control
when i put in a letter in a textbox?
for instance. when i type the letter "A" in the textbox i want to run a...
|
by: Eva |
last post by:
Hi
I have 2 comboboxes on my form that gathers 2 parameters: The Caravan_Name and the caravan_Length. these 2 values that the user selects are placed into a stored procedure as parameters. The...
|
by: CapeCoder |
last post by:
I'd like to use the Excel.WorksheetFunction library to compute median
and percentiles in a user-defined function. I'd like to use the data
from the calling report as the function argument.
...
|
by: DLN |
last post by:
I want to create a form page that has a single field on it, say "last
name", and when that last name is entered in, I want to click a button and
have it bring up another page with the results. Any...
|
by: Jeremy |
last post by:
I have a datasheet subform that is based off an ADO recordset. All is
fine excpet the query results are displayed oddly. Rather than
displaying the results as say 95.43, it displays it as...
|
by: Steven Smith |
last post by:
Hi guys
What I'm trying to do today is display the results from
an SQL query on one table in a Datagrid I'm using the
following code to query the table.
\\\
Try
If...
|
by: Ed244 |
last post by:
Hi,
I'm in the process of producing a database for a college project and have a slight problem I was wondering whether you could help me with.
The area I'm having problems with takes a value...
|
by: lorirobn |
last post by:
Hi,
I have a report displaying items that are missing from a room. I
created 2 queries, the first getting the items IN the room, and the
second being an "unmatched" query that references the...
|
by: russot00 |
last post by:
I have 3 drop down menus that are used in a search to locate restaurants in a db. All of the drop down menus function, a search can be submitted with any combination of drop downs and the results are...
|
by: MeoLessi9 |
last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
| |