User Profile
Collapse
-
as you can see from my query1 function i tried the insert it into a text field but it wont work -
results from query to textbox in GUI
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?
...Code:from Tkinter import * import analyse def -
hahha thanks bvdet it works perfectly!! btw i had to add it before the names were mentioned.Leave a comment:
-
how would i do that?..i've never learnt about global before..:s...Leave a comment:
-
hmm acutally inputting that code didn't work :s, it still says q1_data is not definedLeave a comment:
-
-
for some reason that isnt working for me...
...Code:def evClear(): q1_data.delete(0,END) q2_data.delete(0,END) q3_data.delete(0,END) q3_data2.delete(0,END) def quit(window): window.destroy() def run_analyse(db): window = Tk() frame = Frame(window) frame.pack() q1_promptLeave a comment:
-
GUI text entry tkinter
so basically my GUI window has 4 text entries where the user inputs stuff. i have created a clear button with in my window, the thing that i was wondering is how do i create a function to associate with the clear button to clear all text entries entered by the user?.
thanks -
-
very simple string to list function
the question that im wondering is how do i split into one list of str, say "123456789" into for every third value
so the output would be ['123' , '456' , '789']
thanks -
-
i think im close...can you debug my code
...Code:import urllib def qwerty(f): a = urllib.urlopen(f) s = "" l = a.readlines() y = s.join(l) #p = y.replace('\r', "") q = y.split('\r') output = [] for item in q: if item.startswith('>'): output.append([item.strip(),Leave a comment:
-
-
yep that makes a lot of sense, and i understand fully what your trying to say except i forgot to say that the file could also be
file =
>123
qwerty
ioweio
>567
tyuiyuy
>987
poiuyt
output = [[">123" , "qwertyiowe io"] , [">567" , "tyuiuy"] , ["987" , "poiuyt"]]
the output for...Leave a comment:
-
file to nested list
I'm having alot of troubles with this...so basically i am given a file for example:
File =
>123
qwerty
>567
tyuiyuy
>987
poiuyt
and basically the output is supposed to be [[">123" , "qwerty"] , [">567" , "tyuiuy"] , ["987" , "poiuyt"]]
i have no idea how to do that can someone help... -
I think i know why i got that error, its because i tested a file such as
the first line did not have the seperator hence the error.Code:s = ''' dfs ghj hge abc def ghj jkl def jkk uio def asd '''
also another thing if the test file were to be
since...Code:s = ''' dfs ghj hge abc def ghj jkl def jkk uio def asd dfs def qwe '''
Leave a comment:
-
...Code:import urllib def file_to_dict(a, s): '''Return a dictionary that contains the contents of each line in a given open file as a key-value pair. The file contains lines of the form key separator value, where separator is the second parameter of the function. There may be more than one occurrence of the separator in the line; the key is before the first one - all others are partLeave a comment:
-
-
merging dictionaries
so basically i've written most of the code the only problem that i'm having is that the output that it gives me will not return a key with a different type. It will either return me keys with only int, or only str..for example
...Code:def merge_dictionaries(d1, d2): '''Return a dictionary that is the result of merging the two given dictionaries. In the new dictionary, the values should be lists. If a key -
yep i've tried to code it myself but what i have so far is i've basically made the file into a string and then in split it using the seperator. it's just that now im stuck with the word before the seperator as the key and after the seperator as the value.Leave a comment:
No activity results to display
Show More
Leave a comment: