pysimpleGui 之table使用

(class) Table(values, headings=None, visible_column_map=None, col_widths=None, def_col_width=10, auto_size_columns=True, max_col_width=20, select_mode=None, display_row_numbers=False, num_rows=None, row_height=None, font=None, justification=’right’, text_color=None, background_color=None, alternating_row_color=None, selected_row_colors=(None, None), header_text_color=None, header_background_color=None, header_font=None, row_colors=None, vertical_scroll_only=True, hide_vertical_scroll=False, size=(None, None), s=(None, None), change_submits=False, enable_events=False, bind_return_key=False, pad=None, key=None, k=None, tooltip=None, right_click_menu=None, visible=True, metadata=None)

1、必选项 values,表格中的数据,是一个二维list

:param values: 表格的数据,第二层每个list为一行,各list的相同位置的元素必须为同一个类型。
:type values: List[List[str | int | float]] 双层list类型

2.表头可选性,默认值为无表头,list类型,与values的每一行有同等的列
:param headings: The headings to show on the top line 表头
:type headings: List[str] 列表

3.列是否显示
:param visible_column_map: One entry for each column. False indicates the column is not shown,是否显示该列,每列一个值,False表示不显示
:type visible_column_map: List[bool]list类型

4、列宽设置
:param col_widths: Number of characters that each column will occupy 列宽:
:type col_widths: List[int],list类型
:param def_col_width: Default column width in characters 以字符表示列的宽度
:type def_col_width: (int)
:param auto_size_columns: if True columns will be sized automatically,是否自动调整列宽,如果是True,则是自动调整
:type auto_size_columns: (bool)
:param max_col_width: Maximum width for all columns in characters 以字符表示的所有列的最大宽度
:type max_col_width: (int)

5、选择类型 select_mode
:param select_mode: Select Mode. Valid values start with “TABLE_SELECT_MODE_”. Valid values are: TABLE_SELECT_MODE_NONE TABLE_SELECT_MODE_BROWSE TABLE_SELECT_MODE_EXTENDED
:type select_mode: (enum)

注:这里有三个值,none, browse, or extended none 不可选择,browse 可以单选,extended 多选

此时各列不可选

使用 select_mode = ‘browse’可以选择一列

使用 select_mode = ‘extended’可以使用shift键活ctrl键多选

行号显示,如果为True 第一列显示行号

:param display_row_numbers: if True, the first column of the table will be the row #
:type display_row_numbers: (bool)

行数,表格一次显示的行数
:param num_rows: The number of rows of the table to display at a time
:type num_rows: (int)

行高
:param row_height: height of a single row in pixels
:type row_height: (int)

字体设置
:param font: specifies the font family, size, etc
:type font: str | Tuple[str, int]

调整
:param justification: ‘left’, ‘right’, ‘center’ are valid choices
:type justification: (str)

字体颜色
:param text_color: color of the text
:type text_color: (str)

背景色
:param background_color: color of background
:type background_color: (str)

交替颜色设置可以使用”red” “blue” ,也可以使用十六位颜色代码
:param alternating_row_color: if set then every other row will have this color in the background.

:type alternating_row_color: (str)

选择行颜色,设置选定行的文本颜色和背景颜色。与按钮颜色元组(‘red’, ‘yellow’)或字符串’red on yellow’相同的格式。默认为主题按钮的颜色
:param selected_row_colors: Sets the text color and background color for a selected row. Same format as button colors – tuple (‘red’, ‘yellow’) or string ‘red on yellow’. Defaults to theme’s button color
:type selected_row_colors: str or (str, str)

表头文字颜色
:param header_text_color: sets the text color for the header
:type header_text_color: (str)

表头背景颜色

:param header_background_color: sets the background color for the header
:type header_background_color: (str)

表头字体
:param header_font: specifies the font family, size, etc
:type header_font: str | Tuple[str, int]

行颜色(以下略)
:param row_colors: list of tuples of (row, background color) OR (row, foreground color, background color). Sets the colors of listed rows to the color(s) provided (note the optional foreground color)
:type row_colors: List[Tuple[int, str] | Tuple[Int, str, str]]
:param vertical_scroll_only: if True only the vertical scrollbar will be visible
:type vertical_scroll_only: (bool)
:param hide_vertical_scroll: if True vertical scrollbar will be hidden
:type hide_vertical_scroll: (bool)
:param size: DO NOT USE! Use num_rows instead
:type size: (int, int)
:param change_submits: DO NOT USE. Only listed for backwards compat – Use enable_events instead
:type change_submits: (bool)
:param enable_events: Turns on the element specific events. Table events happen when row is clicked
:type enable_events: (bool)
:param bind_return_key: if True, pressing return key will cause event coming from Table, ALSO a left button double click will generate an event if this parameter is True
:type bind_return_key: (bool)
:param pad: Amount of padding to put around element (left/right, top/bottom) or ((left, right), (top, bottom))
:type pad: (int, int) or ((int, int),(int,int)) or (int,(int,int)) or ((int, int),int)
:param key: Used with window.FindElement and with return values to uniquely identify this element to uniquely identify this element
:type key: str | int | tuple | object
:param k: Same as the Key. You can use either k or key. Which ever is set will be used.

:type k: str | int | tuple | object
:param tooltip: text, that will appear when mouse hovers over the element
:type tooltip: (str)
:param right_click_menu: A list of lists of Menu items to show when this element is right clicked. See user docs for exact format.

:type right_click_menu: List[List[ List[str] | str ]]
:param visible: set visibility state of the element
:type visible: (bool)
:param metadata: User metadata that can be set to ANYTHING
:type metadata: (Any)

Original: https://www.cnblogs.com/jilingxf/p/15880190.html
Author: jilingxf
Title: pysimpleGui 之table使用

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/609906/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

  • Linux入门命令

    命令入门 命令提示符详解 find cut sort wc sed aws [root@localhost ~]# # /root [lilei@node1 ~]$ #/home/…

    Linux 2023年6月11日
    092
  • Shell 脚本大全之检测两台服务器指定目录下的文件一致性

    Shell 脚本大全之检测两台服务器指定目录下的文件一致性 bash;gutter:true;</p> <h1>!/bin/bash</h1> …

    Linux 2023年5月28日
    0112
  • 安装webgot漏洞实验平台时遇到的java环境配置问题

    6 .安装并注册 依次执行命令: 将已下载的Java版本登记为替代版本,将其改成作为默认版本来使用: update-alternatives –install /usr…

    Linux 2023年6月13日
    072
  • centos7自动化ssh免密

    在做免密前要先手动生成公钥: ssh-keygen -t rsa 敲击三次回车即可 写一个shell脚本: expect命令可以获取到命令返回结果并且根据指定内容进行自动发送相应字…

    Linux 2023年6月6日
    0152
  • linux inode 详解 / 线上inode爆满解决方案

    linux inode 详解 / 线上inode爆满解决方案 本文大量参考阮一峰大神博客,整理笔记 &#x4E4B;&#x6240;&#x4EE5;&amp…

    Linux 2023年6月7日
    0119
  • url参数+,&,=,/等转义编码【转】

    问题描述 在使用postman发送请求时,url出现了有+,空格,/,?,%,#,&,= 等特殊符号,可能在转义之后导致服务器端无法获得正确的参数值。解决办法 将这些字符转…

    Linux 2023年6月8日
    090
  • 3.20 什么是环境变量,Linux环境变量有哪些?

    变量是计算机系统用于保存可变值的数据类型,我们可以直接通过变量名称来提取到对应的变量值。在 Linux 系统中,环境变量是用来定义系统运行环境的一些参数,比如每个用户不同的家目录(…

    Linux 2023年6月7日
    0110
  • 环境变量

    环境变量,简单来说就是描述程序执行环境的一组变量。 1、什么程序执行环境? 环境已经基础词汇呢,我们通常都用环境去解释别的词,想一下,日常生活怎么用环境。你到一个新地方,我问你环境…

    Linux 2023年6月6日
    0130
  • MySQL slow log 慢日志

    sql慢日志用于记录执行时间超过指定阈值的SQL,对于系统性能和故障排错非常有帮助 1.如何开启sql慢日志 –&#x5F00;&#x542F;slow log …

    Linux 2023年6月6日
    080
  • MySQL-创建表

    如何在指定数据库中创建表 我们先来了解一下在数据库中创建表的规则: CREATE TABLE 表名 ( 字段名,数据类型, 字段名,数据类型, ….. ) 例如: 添加…

    Linux 2023年6月8日
    0127
  • 灵感来袭,基于Redis的分布式延迟队列

    延迟队列 延迟队列,也就是一定时间之后将消息体放入队列,然后消费者才能正常消费。比如1分钟之后发送短信,发送邮件,检测数据状态等。 Redisson Delayed Queue 如…

    Linux 2023年5月28日
    093
  • 003Linux查看文件内容的5个命令姿势

    Linux 中查看文件内容常用的有如下 5 个命令: cat cat 命令常用格式示例: cat [文件名] # 输出文件所有内容到屏幕上。 cat [文件1] [文件2] # 输…

    Linux 2023年5月27日
    097
  • JavaScript快速入门-08-JSON

    8 JSON 因平时工作时,使用JSON的场景比较多,其JSON语法不再介绍,仅介绍在JavaScript中JSON的解析和序列化。 8.1 JSON 对象 JSON对象有两个方法…

    Linux 2023年6月7日
    0110
  • 【原创】Linux虚拟化KVM-Qemu分析(六)之中断虚拟化

    背景 Read the fucking source code! –By 鲁迅 A picture is worth a thousand words. –…

    Linux 2023年6月8日
    0112
  • 什么是可调CAP策略?为什么需要可调CAP策略?

    在说可调CAP策略之前,我们要先说说CAP理论。 CAP理论是设计分布式系统必用的黄金法则,它提出了设计分布式系统的三个基本要求:一致性(Consistency)、可用性(Avai…

    Linux 2023年6月6日
    0121
  • linux三剑客试题汇总

    1、找出/proc/meminfo文件中以s开头的行,至少用三种方式忽略大小写 2、显示etc目录下以root,centos或者user开头的信息 3、找出/etc/init.d/…

    Linux 2023年5月27日
    0112
亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球