stickies.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:sticky-notes 作者: rubyAce71697 项目源码 文件源码
def get_text(self,parent, message, default=''):
        """
        Display a dialog with a text entry.
        Returns the text, or None if canceled.
        """
        dialog = Gtk.MessageDialog(self.window, 0, Gtk.MessageType.INFO,
            Gtk.ButtonsType.OK, "Enter the Title")
        dialog.add_button("CANCEL",Gtk.ButtonsType.CANCEL)

        entry = Gtk.Entry()
        entry.set_text(default)
        entry.show()
        box = dialog.get_content_area()
        box.add(entry)

        entry.connect('activate', lambda _: dialog.response(Gtk.ResponseType.OK))
        dialog.set_default_response(Gtk.ResponseType.OK)

        r = dialog.run()
        text = entry.get_text().decode('utf8')
        dialog.destroy()
        if r == Gtk.ResponseType.OK:
            return text
        else:
            return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号