上一页 1 2 3 4 5 6 7 8 ··· 12 下一页
摘要: 传递一组无线按钮名称的列表, 返回用户选择的是哪个选项: ```python import tkinter as tk import threading from tkinter import Menu, Frame, Label class RatioButtons(tk.Frame): '''对 阅读全文
posted @ 2023-07-18 10:38 顺其自然,道法自然 阅读(24) 评论(0) 推荐(0) 编辑
摘要: 先上代码: ```python from tkinter import * root = Tk() selected_var = IntVar() radiobutton = Radiobutton(root, text='hzq1', variable=selected_var, value=88 阅读全文
posted @ 2023-07-16 19:36 顺其自然,道法自然 阅读(38) 评论(0) 推荐(0) 编辑
摘要: simpledialog.askstring还是比较好用的, 能够很方便的获取用户输入的文本, 但是在多线程中会出现下面的错误: `_tkinter.TclError: window ".!_querystring" was deleted before its visibility changed 阅读全文
posted @ 2023-07-15 12:21 顺其自然,道法自然 阅读(342) 评论(0) 推荐(0) 编辑
摘要: 今天遇到一个奇怪的问题, 如下面的代码: ```python import tkinter as tk from tkinter import simpledialog def popup(): user_input = tk.simpledialog.askstring("输入对话框", "请输入 阅读全文
posted @ 2023-07-14 15:14 顺其自然,道法自然 阅读(16) 评论(0) 推荐(0) 编辑
摘要: python的类型注释还是很方便的, 相当于动态语言中增加类型系统, 很方便支持代码自动补全. 但是它毕竟不是编译型语言, 如果引用的类型在后面定义, 就会出现找不到此类型的提示. 这时候只需要把这个类型当作字符串就可以了, 不仅不会报错, 仍然还会享受代码补全的好处. 如下所示: ```pytho 阅读全文
posted @ 2023-07-14 10:55 顺其自然,道法自然 阅读(102) 评论(0) 推荐(0) 编辑
摘要: TK增加菜单项的编码是比较复杂的, 为方便使用, 我做了一下封装, 用户使用场景: ```python root = tk.Tk() AddMenuItem(root,'File.New.Close',lambda:print('111')) AddMenuItem(root,'File.Hzq', 阅读全文
posted @ 2023-07-11 22:33 顺其自然,道法自然 阅读(20) 评论(0) 推荐(0) 编辑
摘要: 直接上代码: ```python from tkinter import * def print_menu_items(menu): num_items = menu.index('end') # 最后一个菜单项的索引 for index in range(num_items+1): # 遍历所有的 阅读全文
posted @ 2023-07-10 19:21 顺其自然,道法自然 阅读(57) 评论(0) 推荐(0) 编辑
摘要: python的lxml模块是处理xml文档的比较好用的工具, 其中的xpath函数可以检索指定的元素, 但是它不支持正则表达式, 比如某个属性的值是否匹配某个正则表达式, 就没有办法实现. 不过可以利用它的自定义函数扩展功能来实现, 如下代码所示: ```python import re from 阅读全文
posted @ 2023-07-05 11:23 顺其自然,道法自然 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 源码如下: ```python def _install_uiautomator_apks(self): """ use uiautomator 2.0 to run uiautomator test 通常在连接USB数据线的情况下调用 """ self.shell("pm", "uninstall 阅读全文
posted @ 2023-07-02 11:28 顺其自然,道法自然 阅读(244) 评论(0) 推荐(0) 编辑
摘要: minitouch是帮助模拟手机触摸的工具, atx-agent不安装它也可以. - 首先, 确定minitouch的下载地址, 如下面地址所示: `'https://github.com/openatx/stf-binaries/raw/0.3.0/node_modules/@devicefarm 阅读全文
posted @ 2023-07-02 09:57 顺其自然,道法自然 阅读(398) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 12 下一页