你回来了?
我们一直在隔壁!

一个简单的桌面版备忘贴

# -*- 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()
赞(0)
版权声明:本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权
文章名称:《一个简单的桌面版备忘贴》
文章链接:https://www.gebizhan.com/1743.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。

隔壁评论 抢沙发

快来看啊,隔壁站!

我们就是隔壁站的老王

隔壁邮箱隔壁TG

登录

找回密码

注册