Demonstration of how to get the value as we don't want actual saving done in this script
This commit is contained in:
parent
5792d1e6a5
commit
67ff99afe1
1 changed files with 10 additions and 3 deletions
|
@ -15,7 +15,10 @@ class PromptWindow(Gtk.Window):
|
||||||
self.set_size_request(500, 100)
|
self.set_size_request(500, 100)
|
||||||
self.set_border_width(10)
|
self.set_border_width(10)
|
||||||
|
|
||||||
vbox = Gtk.Box(spacing=10)
|
# This is needed to end the thread if the dialog is closed with the X.
|
||||||
|
self.connect("destroy", Gtk.main_quit)
|
||||||
|
|
||||||
|
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=10)
|
||||||
self.add(vbox)
|
self.add(vbox)
|
||||||
|
|
||||||
self.entry = Gtk.Entry()
|
self.entry = Gtk.Entry()
|
||||||
|
@ -38,12 +41,16 @@ class PromptWindow(Gtk.Window):
|
||||||
def save(self, item):
|
def save(self, item):
|
||||||
# Note: item is the entry directly if enter is pressed, but the button
|
# Note: item is the entry directly if enter is pressed, but the button
|
||||||
# (i guess) if the button is pressed, so we do not use it.
|
# (i guess) if the button is pressed, so we do not use it.
|
||||||
task = self.entry.get_text()
|
self.task = self.entry.get_text()
|
||||||
print(task)
|
|
||||||
# A little concerned this might be sort of the nuclear option here.
|
# A little concerned this might be sort of the nuclear option here.
|
||||||
Gtk.main_quit()
|
Gtk.main_quit()
|
||||||
|
|
||||||
|
def retrieve(self):
|
||||||
|
return self.task
|
||||||
|
|
||||||
|
|
||||||
win = PromptWindow(task="Making money")
|
win = PromptWindow(task="Making money")
|
||||||
win.show_all()
|
win.show_all()
|
||||||
Gtk.main()
|
Gtk.main()
|
||||||
|
tha_task = win.retrieve()
|
||||||
|
print(tha_task)
|
||||||
|
|
Loading…
Reference in a new issue