基于Python開發(fā)一個(gè)桌面便簽工具
前言
一個(gè)功能豐富的桌面置頂便簽小工具,使用Python和tkinter開發(fā)。
功能特點(diǎn)
- 窗口置頂: 便簽窗口始終保持在桌面最前端
- 自動(dòng)保存: 程序關(guān)閉時(shí)自動(dòng)保存內(nèi)容和配置
- 字體自定義: 支持修改字體類型和大小
- 顏色主題: 可自定義背景色和文字顏色
- 文件操作: 支持新建、打開、保存文本文件
- 實(shí)時(shí)時(shí)間: 顯示當(dāng)前日期和時(shí)間
- 快捷鍵支持: 常用操作的鍵盤快捷鍵
使用方法
方法:直接運(yùn)行Python文件
python sticky_notes.py
快捷鍵
Ctrl + S: 保存文件
Ctrl + N: 新建便簽
Ctrl + O: 打開文件
菜單功能
文件菜單
- 新建: 清空當(dāng)前內(nèi)容,創(chuàng)建新便簽
- 打開: 打開已保存的文本文件
- 保存: 將當(dāng)前內(nèi)容保存為文件
- 退出: 關(guān)閉程序
設(shè)置菜單
- 字體設(shè)置: 修改字體類型和大小
- 顏色設(shè)置: 自定義背景色和文字顏色
- 置頂設(shè)置: 開啟/關(guān)閉窗口置頂功能
幫助菜單
關(guān)于: 查看程序信息和使用說明
工具欄按鈕
新建: 創(chuàng)建新便簽
保存: 保存當(dāng)前內(nèi)容
清空: 清空所有文本內(nèi)容
自動(dòng)保存功能
程序會(huì)自動(dòng)保存以下內(nèi)容:
- 便簽文本內(nèi)容(保存在 sticky_notes_content.txt)
- 程序配置設(shè)置(保存在 sticky_notes_config.json)
- 窗口位置和大小
- 字體和顏色設(shè)置
系統(tǒng)要求
Python 3.6 或更高版本
tkinter 庫(Python標(biāo)準(zhǔn)庫,通常已包含)
文件說明
- sticky_notes.py: 主程序文件
- run.bat: Windows啟動(dòng)腳本
- sticky_notes_config.json: 配置文件(自動(dòng)生成)
- sticky_notes_content.txt: 內(nèi)容文件(自動(dòng)生成)
注意事項(xiàng)
- 首次運(yùn)行時(shí)會(huì)創(chuàng)建配置文件和內(nèi)容文件
- 程序關(guān)閉時(shí)會(huì)自動(dòng)保存當(dāng)前狀態(tài)
- 如需重置所有設(shè)置,可刪除配置文件重新啟動(dòng)程序
- 支持中文顯示和輸入
故障排除
如果程序無法啟動(dòng),請檢查:
- 是否已正確安裝Python
- Python是否已添加到系統(tǒng)PATH環(huán)境變量
- 是否有足夠的權(quán)限在當(dāng)前目錄創(chuàng)建文件
完整代碼
import tkinter as tk from tkinter import messagebox, filedialog, colorchooser, font import json import os from datetime import datetime class StickyNoteEnhanced: def __init__(self): self.root = tk.Tk() self.root.title("桌面便簽工具 Enhanced") self.root.geometry("450x350") self.root.configure(bg='#FFFACD') # 設(shè)置窗口置頂 self.root.attributes('-topmost', True) # 配置文件路徑 self.config_file = "sticky_notes_config.json" self.notes_dir = "saved_notes" # 創(chuàng)建保存目錄 if not os.path.exists(self.notes_dir): os.makedirs(self.notes_dir) # 默認(rèn)配置 self.config = { 'font_size': 12, 'font_family': 'Microsoft YaHei', 'bg_color': '#FFFACD', 'text_color': '#000000', 'window_size': '450x350', 'window_position': '+100+100', 'always_on_top': True, 'transparency': 1.0, 'auto_save': True } # 加載配置 self.load_config() # 創(chuàng)建界面 self.create_widgets() # 加載保存的內(nèi)容 self.load_content() # 綁定關(guān)閉事件 self.root.protocol("WM_DELETE_WINDOW", self.on_closing) # 自動(dòng)保存定時(shí)器 if self.config['auto_save']: self.auto_save_timer() def create_widgets(self): """創(chuàng)建界面組件""" # 創(chuàng)建菜單欄 menubar = tk.Menu(self.root) self.root.config(menu=menubar) # 文件菜單 file_menu = tk.Menu(menubar, tearoff=0) menubar.add_cascade(label="文件", menu=file_menu) file_menu.add_command(label="新建", command=self.new_note) file_menu.add_command(label="打開", command=self.open_file) file_menu.add_command(label="保存", command=self.save_file) file_menu.add_command(label="另存為", command=self.save_as_file) file_menu.add_separator() file_menu.add_command(label="導(dǎo)入", command=self.import_note) file_menu.add_command(label="導(dǎo)出", command=self.export_note) file_menu.add_separator() file_menu.add_command(label="退出", command=self.on_closing) # 編輯菜單 edit_menu = tk.Menu(menubar, tearoff=0) menubar.add_cascade(label="編輯", menu=edit_menu) edit_menu.add_command(label="撤銷", command=self.undo) edit_menu.add_command(label="重做", command=self.redo) edit_menu.add_separator() edit_menu.add_command(label="剪切", command=self.cut_text) edit_menu.add_command(label="復(fù)制", command=self.copy_text) edit_menu.add_command(label="粘貼", command=self.paste_text) edit_menu.add_separator() edit_menu.add_command(label="全選", command=self.select_all) edit_menu.add_command(label="查找", command=self.find_text) # 設(shè)置菜單 settings_menu = tk.Menu(menubar, tearoff=0) menubar.add_cascade(label="設(shè)置", menu=settings_menu) settings_menu.add_command(label="字體設(shè)置", command=self.font_settings) settings_menu.add_command(label="顏色設(shè)置", command=self.color_settings) settings_menu.add_command(label="透明度設(shè)置", command=self.transparency_settings) settings_menu.add_command(label="置頂設(shè)置", command=self.toggle_topmost) settings_menu.add_command(label="自動(dòng)保存", command=self.toggle_auto_save) # 幫助菜單 help_menu = tk.Menu(menubar, tearoff=0) menubar.add_cascade(label="幫助", menu=help_menu) help_menu.add_command(label="快捷鍵", command=self.show_shortcuts) help_menu.add_command(label="關(guān)于", command=self.show_about) # 創(chuàng)建工具欄 toolbar = tk.Frame(self.root, bg=self.config['bg_color']) toolbar.pack(fill=tk.X, padx=5, pady=2) # 工具欄按鈕 tk.Button(toolbar, text="新建", command=self.new_note, width=6).pack(side=tk.LEFT, padx=2) tk.Button(toolbar, text="打開", command=self.open_file, width=6).pack(side=tk.LEFT, padx=2) tk.Button(toolbar, text="保存", command=self.save_file, width=6).pack(side=tk.LEFT, padx=2) tk.Button(toolbar, text="清空", command=self.clear_text, width=6).pack(side=tk.LEFT, padx=2) # 分隔符 tk.Frame(toolbar, width=2, bg='gray').pack(side=tk.LEFT, fill=tk.Y, padx=5) # 字體大小調(diào)節(jié) tk.Label(toolbar, text="字號:", bg=self.config['bg_color']).pack(side=tk.LEFT, padx=2) self.font_size_var = tk.StringVar(value=str(self.config['font_size'])) font_size_combo = tk.Spinbox(toolbar, from_=8, to=72, width=5, textvariable=self.font_size_var, command=self.change_font_size) font_size_combo.pack(side=tk.LEFT, padx=2) # 時(shí)間標(biāo)簽 self.time_label = tk.Label(toolbar, text="", bg=self.config['bg_color'], fg=self.config['text_color']) self.time_label.pack(side=tk.RIGHT, padx=5) self.update_time() # 創(chuàng)建文本編輯區(qū)域 text_frame = tk.Frame(self.root) text_frame.pack(fill=tk.BOTH, expand=True, padx=5, pady=5) # 文本框 self.text_area = tk.Text( text_frame, font=(self.config['font_family'], self.config['font_size']), bg=self.config['bg_color'], fg=self.config['text_color'], wrap=tk.WORD, undo=True, maxundo=50 ) # 滾動(dòng)條 scrollbar = tk.Scrollbar(text_frame) scrollbar.pack(side=tk.RIGHT, fill=tk.Y) self.text_area.pack(side=tk.LEFT, fill=tk.BOTH, expand=True) self.text_area.config(yscrollcommand=scrollbar.set) scrollbar.config(command=self.text_area.yview) # 狀態(tài)欄 status_frame = tk.Frame(self.root) status_frame.pack(side=tk.BOTTOM, fill=tk.X) self.status_bar = tk.Label( status_frame, text="就緒", relief=tk.SUNKEN, anchor=tk.W, bg=self.config['bg_color'], fg=self.config['text_color'] ) self.status_bar.pack(side=tk.LEFT, fill=tk.X, expand=True) # 字符統(tǒng)計(jì)標(biāo)簽 self.char_count_label = tk.Label( status_frame, text="字符: 0", relief=tk.SUNKEN, bg=self.config['bg_color'], fg=self.config['text_color'] ) self.char_count_label.pack(side=tk.RIGHT, padx=5) # 綁定事件 self.bind_events() def bind_events(self): """綁定快捷鍵和事件""" # 快捷鍵 self.root.bind('<Control-s>', lambda e: self.save_file()) self.root.bind('<Control-n>', lambda e: self.new_note()) self.root.bind('<Control-o>', lambda e: self.open_file()) self.root.bind('<Control-z>', lambda e: self.undo()) self.root.bind('<Control-y>', lambda e: self.redo()) self.root.bind('<Control-a>', lambda e: self.select_all()) self.root.bind('<Control-f>', lambda e: self.find_text()) self.root.bind('<Control-plus>', lambda e: self.increase_font()) self.root.bind('<Control-minus>', lambda e: self.decrease_font()) # 文本變化事件 self.text_area.bind('<KeyRelease>', self.on_text_change) self.text_area.bind('<Button-1>', self.on_text_change) def update_time(self): """更新時(shí)間顯示""" current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S") self.time_label.config(text=current_time) self.root.after(1000, self.update_time) def on_text_change(self, event=None): """文本變化時(shí)的處理""" content = self.text_area.get(1.0, tk.END) char_count = len(content) - 1 # 減去末尾的換行符 self.char_count_label.config(text=f"字符: {char_count}") def change_font_size(self): """改變字體大小""" try: new_size = int(self.font_size_var.get()) self.config['font_size'] = new_size self.text_area.config(font=(self.config['font_family'], new_size)) self.save_config() except ValueError: pass def increase_font(self): """增大字體""" current_size = self.config['font_size'] if current_size < 72: self.config['font_size'] = current_size + 1 self.font_size_var.set(str(self.config['font_size'])) self.text_area.config(font=(self.config['font_family'], self.config['font_size'])) self.save_config() def decrease_font(self): """減小字體""" current_size = self.config['font_size'] if current_size > 8: self.config['font_size'] = current_size - 1 self.font_size_var.set(str(self.config['font_size'])) self.text_area.config(font=(self.config['font_family'], self.config['font_size'])) self.save_config() def new_note(self): """新建便簽""" if self.text_area.get(1.0, tk.END).strip(): if messagebox.askyesno("新建", "當(dāng)前內(nèi)容未保存,是否繼續(xù)?"): self.text_area.delete(1.0, tk.END) self.status_bar.config(text="新建便簽") else: self.text_area.delete(1.0, tk.END) self.status_bar.config(text="新建便簽") def save_file(self): """保存文件""" try: content = self.text_area.get(1.0, tk.END) if not hasattr(self, 'current_file') or not self.current_file: self.save_as_file() return with open(self.current_file, 'w', encoding='utf-8') as f: f.write(content) self.status_bar.config(text=f"已保存: {os.path.basename(self.current_file)}") except Exception as e: messagebox.showerror("錯(cuò)誤", f"保存失敗: {str(e)}") def save_as_file(self): """另存為文件""" try: content = self.text_area.get(1.0, tk.END) filename = filedialog.asksaveasfilename( defaultextension=".txt", filetypes=[("文本文件", "*.txt"), ("所有文件", "*.*")] ) if filename: with open(filename, 'w', encoding='utf-8') as f: f.write(content) self.current_file = filename self.status_bar.config(text=f"已保存: {os.path.basename(filename)}") messagebox.showinfo("保存", "文件保存成功!") except Exception as e: messagebox.showerror("錯(cuò)誤", f"保存失敗: {str(e)}") def open_file(self): """打開文件""" try: filename = filedialog.askopenfilename( filetypes=[("文本文件", "*.txt"), ("所有文件", "*.*")] ) if filename: with open(filename, 'r', encoding='utf-8') as f: content = f.read() self.text_area.delete(1.0, tk.END) self.text_area.insert(1.0, content) self.current_file = filename self.status_bar.config(text=f"已打開: {os.path.basename(filename)}") except Exception as e: messagebox.showerror("錯(cuò)誤", f"打開失敗: {str(e)}") def import_note(self): """導(dǎo)入便簽""" self.open_file() def export_note(self): """導(dǎo)出便簽""" self.save_as_file() def clear_text(self): """清空文本""" if messagebox.askyesno("清空", "確定要清空所有內(nèi)容嗎?"): self.text_area.delete(1.0, tk.END) self.status_bar.config(text="已清空內(nèi)容") def undo(self): """撤銷""" try: self.text_area.edit_undo() except tk.TclError: pass def redo(self): """重做""" try: self.text_area.edit_redo() except tk.TclError: pass def cut_text(self): """剪切""" try: self.text_area.event_generate("<<Cut>>") except: pass def copy_text(self): """復(fù)制""" try: self.text_area.event_generate("<<Copy>>") except: pass def paste_text(self): """粘貼""" try: self.text_area.event_generate("<<Paste>>") except: pass def select_all(self): """全選""" self.text_area.tag_add(tk.SEL, "1.0", tk.END) self.text_area.mark_set(tk.INSERT, "1.0") self.text_area.see(tk.INSERT) return 'break' def find_text(self): """查找文本""" find_window = tk.Toplevel(self.root) find_window.title("查找") find_window.geometry("300x100") find_window.attributes('-topmost', True) tk.Label(find_window, text="查找內(nèi)容:").pack(pady=5) search_var = tk.StringVar() search_entry = tk.Entry(find_window, textvariable=search_var, width=30) search_entry.pack(pady=5) search_entry.focus() def do_find(): search_text = search_var.get() if search_text: start_pos = self.text_area.search(search_text, tk.INSERT, tk.END) if start_pos: end_pos = f"{start_pos}+{len(search_text)}c" self.text_area.tag_remove(tk.SEL, "1.0", tk.END) self.text_area.tag_add(tk.SEL, start_pos, end_pos) self.text_area.mark_set(tk.INSERT, end_pos) self.text_area.see(start_pos) else: messagebox.showinfo("查找", "未找到指定內(nèi)容") tk.Button(find_window, text="查找", command=do_find).pack(pady=5) search_entry.bind('<Return>', lambda e: do_find()) def font_settings(self): """字體設(shè)置""" font_window = tk.Toplevel(self.root) font_window.title("字體設(shè)置") font_window.geometry("350x250") font_window.attributes('-topmost', True) # 字體族 tk.Label(font_window, text="字體:").pack(pady=5) font_var = tk.StringVar(value=self.config['font_family']) font_families = list(font.families()) font_combo = tk.Listbox(font_window, height=6) for family in font_families: font_combo.insert(tk.END, family) font_combo.pack(pady=5, fill=tk.BOTH, expand=True) # 設(shè)置當(dāng)前選中的字體 try: current_index = font_families.index(self.config['font_family']) font_combo.selection_set(current_index) font_combo.see(current_index) except ValueError: pass # 字體大小 size_frame = tk.Frame(font_window) size_frame.pack(pady=5) tk.Label(size_frame, text="大小:").pack(side=tk.LEFT) size_var = tk.IntVar(value=self.config['font_size']) size_spin = tk.Spinbox(size_frame, from_=8, to=72, textvariable=size_var, width=10) size_spin.pack(side=tk.LEFT, padx=5) def apply_font(): selection = font_combo.curselection() if selection: selected_font = font_families[selection[0]] self.config['font_family'] = selected_font self.config['font_size'] = size_var.get() self.text_area.config(font=(self.config['font_family'], self.config['font_size'])) self.font_size_var.set(str(self.config['font_size'])) self.save_config() font_window.destroy() button_frame = tk.Frame(font_window) button_frame.pack(pady=10) tk.Button(button_frame, text="應(yīng)用", command=apply_font).pack(side=tk.LEFT, padx=5) tk.Button(button_frame, text="取消", command=font_window.destroy).pack(side=tk.LEFT, padx=5) def color_settings(self): """顏色設(shè)置""" color_window = tk.Toplevel(self.root) color_window.title("顏色設(shè)置") color_window.geometry("250x200") color_window.attributes('-topmost', True) def choose_bg_color(): color = colorchooser.askcolor(title="選擇背景顏色", initialcolor=self.config['bg_color']) if color[1]: self.config['bg_color'] = color[1] self.apply_colors() def choose_text_color(): color = colorchooser.askcolor(title="選擇文字顏色", initialcolor=self.config['text_color']) if color[1]: self.config['text_color'] = color[1] self.apply_colors() tk.Button(color_window, text="背景顏色", command=choose_bg_color, width=15).pack(pady=10) tk.Button(color_window, text="文字顏色", command=choose_text_color, width=15).pack(pady=10) def reset_colors(): self.config['bg_color'] = '#FFFACD' self.config['text_color'] = '#000000' self.apply_colors() tk.Button(color_window, text="恢復(fù)默認(rèn)", command=reset_colors, width=15).pack(pady=10) tk.Button(color_window, text="關(guān)閉", command=color_window.destroy, width=15).pack(pady=10) def transparency_settings(self): """透明度設(shè)置""" trans_window = tk.Toplevel(self.root) trans_window.title("透明度設(shè)置") trans_window.geometry("300x150") trans_window.attributes('-topmost', True) tk.Label(trans_window, text="透明度 (0.1-1.0):").pack(pady=10) trans_var = tk.DoubleVar(value=self.config['transparency']) trans_scale = tk.Scale(trans_window, from_=0.1, to=1.0, resolution=0.1, orient=tk.HORIZONTAL, variable=trans_var, length=200) trans_scale.pack(pady=10) def apply_transparency(): self.config['transparency'] = trans_var.get() self.root.attributes('-alpha', self.config['transparency']) self.save_config() trans_window.destroy() def preview_transparency(): self.root.attributes('-alpha', trans_var.get()) trans_scale.config(command=lambda x: preview_transparency()) button_frame = tk.Frame(trans_window) button_frame.pack(pady=10) tk.Button(button_frame, text="應(yīng)用", command=apply_transparency).pack(side=tk.LEFT, padx=5) tk.Button(button_frame, text="取消", command=trans_window.destroy).pack(side=tk.LEFT, padx=5) def apply_colors(self): """應(yīng)用顏色設(shè)置""" self.root.configure(bg=self.config['bg_color']) self.text_area.configure(bg=self.config['bg_color'], fg=self.config['text_color']) self.time_label.configure(bg=self.config['bg_color'], fg=self.config['text_color']) self.status_bar.configure(bg=self.config['bg_color'], fg=self.config['text_color']) self.char_count_label.configure(bg=self.config['bg_color'], fg=self.config['text_color']) self.save_config() def toggle_topmost(self): """切換置頂狀態(tài)""" self.config['always_on_top'] = not self.config['always_on_top'] self.root.attributes('-topmost', self.config['always_on_top']) status = "已開啟" if self.config['always_on_top'] else "已關(guān)閉" self.status_bar.config(text=f"窗口置頂 {status}") self.save_config() def toggle_auto_save(self): """切換自動(dòng)保存""" self.config['auto_save'] = not self.config['auto_save'] status = "已開啟" if self.config['auto_save'] else "已關(guān)閉" self.status_bar.config(text=f"自動(dòng)保存 {status}") self.save_config() if self.config['auto_save']: self.auto_save_timer() def auto_save_timer(self): """自動(dòng)保存定時(shí)器""" if self.config['auto_save']: self.save_content() self.root.after(30000, self.auto_save_timer) # 30秒自動(dòng)保存 def show_shortcuts(self): """顯示快捷鍵""" shortcuts_text = """ 快捷鍵列表: Ctrl+N: 新建便簽 Ctrl+O: 打開文件 Ctrl+S: 保存文件 Ctrl+Z: 撤銷 Ctrl+Y: 重做 Ctrl+A: 全選 Ctrl+F: 查找 Ctrl+Plus: 增大字體 Ctrl+Minus: 減小字體 """ messagebox.showinfo("快捷鍵", shortcuts_text) def show_about(self): """顯示關(guān)于信息""" about_text = """ 桌面便簽工具 Enhanced v2.0 功能特點(diǎn): ? 窗口置頂顯示 ? 自動(dòng)保存配置和內(nèi)容 ? 支持字體和顏色自定義 ? 支持透明度調(diào)節(jié) ? 支持文件保存和打開 ? 實(shí)時(shí)時(shí)間和字符統(tǒng)計(jì) ? 豐富的編輯功能 ? 快捷鍵支持 作者:AI助手 版本:2.0 """ messagebox.showinfo("關(guān)于", about_text) def load_config(self): """加載配置""" try: if os.path.exists(self.config_file): with open(self.config_file, 'r', encoding='utf-8') as f: saved_config = json.load(f) self.config.update(saved_config) except Exception as e: print(f"加載配置失敗: {e}") def save_config(self): """保存配置""" try: # 保存當(dāng)前窗口位置和大小 geometry = self.root.geometry() if '+' in geometry: self.config['window_size'] = geometry.split('+')[0] self.config['window_position'] = '+' + '+'.join(geometry.split('+')[1:]) with open(self.config_file, 'w', encoding='utf-8') as f: json.dump(self.config, f, ensure_ascii=False, indent=2) except Exception as e: print(f"保存配置失敗: {e}") def load_content(self): """加載保存的內(nèi)容""" try: content_file = "sticky_notes_content.txt" if os.path.exists(content_file): with open(content_file, 'r', encoding='utf-8') as f: content = f.read() self.text_area.insert(1.0, content) except Exception as e: print(f"加載內(nèi)容失敗: {e}") def save_content(self): """保存當(dāng)前內(nèi)容""" try: content = self.text_area.get(1.0, tk.END) content_file = "sticky_notes_content.txt" with open(content_file, 'w', encoding='utf-8') as f: f.write(content) except Exception as e: print(f"保存內(nèi)容失敗: {e}") def on_closing(self): """關(guān)閉程序時(shí)的處理""" self.save_content() self.save_config() self.root.destroy() def run(self): """運(yùn)行程序""" # 應(yīng)用保存的窗口設(shè)置 geometry = self.config['window_size'] + self.config['window_position'] self.root.geometry(geometry) self.root.attributes('-topmost', self.config['always_on_top']) self.root.attributes('-alpha', self.config['transparency']) # 應(yīng)用顏色設(shè)置 self.apply_colors() self.root.mainloop() if __name__ == "__main__": app = StickyNoteEnhanced() app.run()
效果圖
到此這篇關(guān)于基于Python開發(fā)一個(gè)桌面便簽工具的文章就介紹到這了,更多相關(guān)Python便簽內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
解決Pandas to_json()中文亂碼,轉(zhuǎn)化為json數(shù)組的問題
今天小編就為大家分享一篇解決Pandas to_json() 中文亂碼,轉(zhuǎn)化為json數(shù)組的問題,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧2018-05-05Python 根據(jù)日志級別打印不同顏色的日志的方法示例
這篇文章主要介紹了Python 根據(jù)日志級別打印不同顏色的日志的方法示例,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-08-08學(xué)會(huì)Python數(shù)據(jù)可視化必須嘗試這7個(gè)庫
數(shù)據(jù)可視化是使用一些繪圖和圖形更詳細(xì)地理解數(shù)據(jù)的過程.最著名的庫之一是 matplotlib,它可以繪制幾乎所有您可以想象的繪圖類型.matplotlib 唯一的問題是初學(xué)者很難掌握.在本文中,我將介紹七個(gè)數(shù)據(jù)可視化庫,你可以嘗試使用它們來代替 matplotlib ,需要的朋友可以參考下2021-06-06Python閉包實(shí)現(xiàn)計(jì)數(shù)器的方法
這篇文章主要介紹了Python閉包實(shí)現(xiàn)計(jì)數(shù)器的方法,分析了閉包的概念及實(shí)現(xiàn)計(jì)數(shù)器的相關(guān)技巧,需要的朋友可以參考下2015-05-05wxPython:python首選的GUI庫實(shí)例分享
wxPython是Python語言的一套優(yōu)秀的GUI圖形庫。允許Python程序員很方便的創(chuàng)建完整的、功能鍵全的GUI用戶界面。 wxPython是作為優(yōu)秀的跨平臺(tái)GUI庫wxWidgets的Python封裝和Python模塊的方式提供給用戶的2019-10-10Django 解決上傳文件時(shí),request.FILES為空的問題
這篇文章主要介紹了Django 解決上傳文件時(shí),request.FILES為空的問題,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧2020-05-05python 中不同包 類 方法 之間的調(diào)用詳解
這篇文章主要介紹了python 中不同包 類 方法 之間的調(diào)用詳解,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧2020-03-03在Python中采集Prometheus數(shù)據(jù)的詳細(xì)用法教程
Prometheus是一個(gè)開源的監(jiān)控和警報(bào)工具,專門用于記錄和查詢時(shí)間序列數(shù)據(jù),它提供了一個(gè)強(qiáng)大的查詢語言PromQL(Prometheus Query Language),允許用戶根據(jù)不同的標(biāo)簽和指標(biāo)選擇特定的時(shí)間序列數(shù)據(jù),本文將詳細(xì)介紹如何在Python中采集Prometheus數(shù)據(jù)2024-07-07