I couldn't access the gtk.Entry()
from other script I wrote since it is run as a separate process (i don't have that knowledge to manipulate processes yet) i did this:
def keyEnter(self, widget, ev):
if ev.keyval == 65293 and not self.TextBox.get_text() == "":
self.TextBox1.grab_focus()
self.TextBox.set_editable(False)
file = open('file.txt', 'w+')
file.write(self.TextBox.get_text())
file.close()
i changed
Meta = self.client.get_file_and_metadata(#here it needs to go self.Textbox.get_text())
that was supposed to download the file with the name written in self.Textbox
i changed it to
Meta = self.client.get_file_and_metadata(getpass.getuser())
and finally the string from self.Textbox
i got through uploading
with open("file.txt", "r") as chat:
data=chat.read().splitlines(True) #split lines in the list
d = str(data[:1]) #take only first line from the list
dat=str(d).strip("[]") #remove the brackets "[]" that remained when string was extracted from the list
with open("file.txt", "w") as chat1:
chat1.writelines(data[1:]) # writes all except the first line
chat.close()
chat1.close()
self.f = open('file.txt', 'rb')
self.response = self.client.put_file(str(dat[:-2]), self.f) #str(dat[:-2]) -> i wanted to remove the newline char "\n"
I dont know if anyone will find this helpful but this solved the problem at my side :))