# -*- coding: utf-8 -*-
"""
A simple sticky note program written in Python.
"""
import tkinter as tk
# Create a window
window = tk.Tk()
window.title('Sticky Note')
window.geometry('400x400')
# Create a text area
text_area = tk.Text(window, width=40, height=20)
text_area.pack()
# Create a button
btn = tk.Button(window, text='Save', width=20, height=2, command=lambda: save_text())
btn.pack()
# Create a function to save text
def save_text():
note_text = text_area.get('1.0', 'end-1c')
with open('note.txt', 'w') as f:
f.write(note_text)
# Run the window
window.mainloop()
一个简单的桌面版备忘贴
版权声明:本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权
文章名称:《一个简单的桌面版备忘贴》
文章链接:https://www.gebizhan.com/1743.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。
文章名称:《一个简单的桌面版备忘贴》
文章链接:https://www.gebizhan.com/1743.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。