'Calling function from file(1). Try to use variable from 'Entry' input of file(2). end up still got file(1) variable
Sorry for the title. I'm not sure how to make it proper for this.
I am scraping website. Most parts are done and now I try to create input fields with TKinter.
Using file Button.py to call a function from file Bitkub_scrape.py. Function make_df() needs value of file_path in order to work.
I want to use the input of Entry field in Button.py file.
It returns:
FileNotFoundError: [Errno 2] No such file or directory: ''
in which '' is from Bitkub_scrape.py.
Here is my function code in 'Bitkub_scrape.py` file:
def make_df():
#for loop make list
for coin, chains, wdf in zip(coin_name_res, chain_name, fee_res):
#print("Coin name: {} Chain: {} Fee: {}".format(coin, chains, wdf))
#create dataframe
df=(pd.DataFrame({'coin_name': coin_name_res[0:100], 'chain_name': chain_name, 'withdrawal_fees':fee_res}))
#print(df)
file_path = ""
#csv
df.to_csv(file_path, index=False)
df_saved_file = pd.read_csv(file_path)
df_saved_file
driver.quit()
make_df()
And here is my Button.py file:
root = tkinter.Tk()
root.title('Bitkub Fee monitor')
root.geometry("500x500")
e = Entry(root, width=60)
e.pack()
def Bitkub():
from Bitkub_scrape import make_df
make_df()
file_path.append(e.get())
Bitkub_label = Label(root,text="Done, Check file name: Bitkub_fee.csv")
Bitkub_label.pack()
print(path)
Bitkub_button = Button(root,text="Get Bitkub Fee", command=Bitkub, height = 5, width = 60, bg="green")
Bitkub_button.pack()
root.mainloop()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
