pomodoroprompt/prompt_window.py

39 lines
834 B
Python
Raw Normal View History

#!/usr/bin/env python3
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GLib
class PromptWindow(Gtk.Window):
def __init__(self, task=None):
if task is None:
task = ""
Gtk.Window.__init__(self, title="Pomodoro Prompt")
self.set_size_request(500, 100)
self.set_border_width(10)
self.entry = Gtk.Entry()
self.entry.set_text(task)
self.entry.connect("activate", self.save)
self.add(self.entry)
# self.set_title("Entry")
self.connect("destroy", Gtk.main_quit)
def save(self, entry):
task = entry.get_text()
print(task)
# A little concerned this might be sort of the nuclear option here.
Gtk.main_quit()
win = PromptWindow(task="Making money")
win.show_all()
Gtk.main()