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)

大家都在看

  • Redis

    Redis原创笑笑师弟 最后发布于2018-12-21 14:17:59 阅读数 1780 收藏展开目录 redis简介 redis功能 redis学习步骤 windows系统下的…

    Linux 2023年5月28日
    0108
  • CH9344 Windows驱动安装与GPIO使用教程

    USB 转四串口芯片 CH9344 用于为 USB 主机扩展 4 路高速异步串口,支持串口波特率高达 12Mbps。芯片内部高度集成,外围精简,提供 VIO 电源引脚,部分串口 I…

    Linux 2023年6月7日
    092
  • @JsonFormat和@DateTimeFormat的作用

    @DatetimeFormat是将String转换成Date,一般前台给后台传值时用 import org.springframework.format.annotation.Da…

    Linux 2023年6月7日
    0101
  • haproxy

    1. haproxy简介 2. haproxy配置文件解析 3. haproxy搭建httpd负载均衡 4. 启动haproxy自带的监控界面 haproxy简介 HAProxy是…

    Linux 2023年6月13日
    0141
  • JavaScript快速入门-06-函数

    6 函数 6.1 函数定义 函数可以封装语句,然后在任何地方、任何时间执行。JavaScript中的函数使用 function关键字声明,主要由 函数名、 函数参数和 函数体组成。…

    Linux 2023年6月7日
    0111
  • web安全之反向代理配置X-Frame-Options实现防盗链和防止点击劫持攻击

    介绍 http响应头安全策略,从http头文件的方面,利用参数设置开启浏览器的安全策略,来实现相关的安全机制 X-Frame-Options HTTP响&am…

    Linux 2023年6月6日
    0128
  • 【总结】瞬时高并发(秒杀/活动)Redis方案

    1,Redis 丰富的数据结构(Data Structures) * 字符串(String) – Redis字符串能包含 任意类型的数据 一个字符串类型的值最多能存储 …

    Linux 2023年5月28日
    091
  • 项目经验示例

    一,期中项目经验示例 1,根据现有结构部署工具(PXE+kickstart)2,结合应用系统需求定制部署模版3,制作系统优化等一键执行脚本4,自动化部署实施5,根据定制的优化内容对…

    Linux 2023年6月7日
    091
  • 高等代数(上)丘维声 笔记

    1 线性方程组的解法 1、线性方程组:左端为未知量x的一次齐次式,右端是常数。关键词:系数、常数项、n元线性方程组、解集 2、线性方程组的初等变换:1)把一个方程的倍数加到另一个方…

    Linux 2023年6月8日
    0119
  • Kubernetes-DashBoard部署

    DashBoard 在kubernetes中完成的所有操作都是通过命令行工具kubectl完成的。其实,为了提供更丰富的用户体验,kubernetes还开发了一个基于web的用户界…

    Linux 2023年6月13日
    098
  • IDEA清空控制台以及Java中运行cmd命令实现清屏操作

    在网上有看到各种的实现方法,比如: Runtime.getRuntime().exec("cls"); 或者&amp…

    Linux 2023年6月6日
    0133
  • HTML笔记整理–下节

    欢迎来到HTML基础笔记下节部分! 内联样式 当特殊的样式需要应用到个别元素时,就可以使用内联样式。 使用内联样式的方法是在相关的标签中使用样式属性。样式属性可以包含任何 CSS …

    Linux 2023年6月13日
    085
  • python正则表达式

    1.定义 正则表达式使用某种预定义的模式去匹配一类具有共同特征的字符串,主要用于处理字符串,可以快速、准确地完成复杂的查找、替换等处理要求。 re模块提供了正则表达式操作所需要的的…

    Linux 2023年6月7日
    0128
  • Rsync数据备份工具

    Rsync数据备份工具 1、Rsync基本概述 rsync是一款开源的备份工具,可以在不同主机之间进行同步(windows和Linux之间 Mac和 Linux Linux和Lin…

    Linux 2023年6月7日
    0103
  • Redis配置参数详解

    Redis是一个应用非常广泛的高性能Key-Value型数据库,与memcached类似,但功能更加强大!本文将按照不同功能模块的方式,依次对各个功能模块的配置参数进行详细介绍。 …

    Linux 2023年5月28日
    091
  • CentOS 7.6 安装 MySQL-5.7.31(RPM方式安装)

    准备工作: 注:5.7.31版本安装步骤及初始化和之前版本有较大区别 CentOS 7.6 系统: 带GUI的服务器 默认安装 MySQL 5.7.31 安装包: 1.RPM安装包…

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