@python tkinter界面可视化工具

最近在学习python之tkinter之大坑。做个简单的界面,做的真是麻烦。发现有几个可视化工具不错。

第一。 the page 。感觉软件不错,就是不会使用。正在慢慢试着。
下载地址:http://page.sourceforge.net

下面是一段用the page生成的代码。具体怎么使用慢慢摸索吧。

 #! /usr/bin/env python#  -*- coding: utf-8 -*-## GUI module generated by PAGE version 6.2#  in conjunction with Tcl version 8.6#    Jan 01, 2022 04:32:47 PM CST  platform: Windows NTimport systry:import Tkinter as tk
except ImportError:import tkinter as tktry:import ttkpy3 = False
except ImportError:import tkinter.ttk as ttkpy3 = Trueimport main_supportdef vp_start_gui():'''Starting point when module is the main routine.'''global val, w, rootroot = tk.Tk()top = Toplevel1 (root)main_support.init(root, top)root.mainloop()w = None
def create_Toplevel1(rt, *args, **kwargs):'''Starting point when module is imported by another module.Correct form of call: 'create_Toplevel1(root, *args, **kwargs)' .'''global w, w_win, root#rt = rootroot = rtw = tk.Toplevel (root)top = Toplevel1 (w)main_support.init(w, top, *args, **kwargs)return (w, top)def destroy_Toplevel1():global ww.destroy()w = Noneclass Toplevel1:def __init__(self, top=None):'''This class configures and populates the toplevel window.top is the toplevel containing window.'''_bgcolor = '#d9d9d9'  # X11 color: 'gray85'_fgcolor = '#000000'  # X11 color: 'black'_compcolor = '#d9d9d9' # X11 color: 'gray85'_ana1color = '#d9d9d9' # X11 color: 'gray85'_ana2color = '#ececec' # Closest X11 color: 'gray92'self.style = ttk.Style()if sys.platform == "win32":self.style.theme_use('winnative')self.style.configure('.',background=_bgcolor)self.style.configure('.',foreground=_fgcolor)self.style.configure('.',font="TkDefaultFont")self.style.map('.',background=[('selected', _compcolor), ('active',_ana2color)])top.geometry("1024x512+397+222")top.minsize(116, 1)top.maxsize(1920, 1058)top.resizable(1,  1)top.title("New Toplevel")top.configure(background="#d9d9d9")top.configure(highlightbackground="#d9d9d9")top.configure(highlightcolor="black")self.style.configure('TNotebook.Tab', background=_bgcolor)self.style.configure('TNotebook.Tab', foreground=_fgcolor)self.style.map('TNotebook.Tab', background=[('selected', _compcolor), ('active',_ana2color)])self.TNbk1 = ttk.Notebook(top)self.TNbk1.place(relx=0.0, rely=0.0, relheight=0.973, relwidth=1.0)self.TNbk1.configure(takefocus="")self.TNbk1_t1 = tk.Frame(self.TNbk1)self.TNbk1.add(self.TNbk1_t1, padding=3)self.TNbk1.tab(0, text="歌单选择",compound="left",underline="-1",)self.TNbk1_t1.configure(background="#d9d9d9")self.TNbk1_t1.configure(highlightbackground="#d9d9d9")self.TNbk1_t1.configure(highlightcolor="black")self.TNbk1_t2 = tk.Frame(self.TNbk1)self.TNbk1.add(self.TNbk1_t2, padding=3)self.TNbk1.tab(1, text="下载任务",compound="left",underline="-1",)self.TNbk1_t2.configure(background="#d9d9d9")self.TNbk1_t2.configure(highlightbackground="#d9d9d9")self.TNbk1_t2.configure(highlightcolor="black")self.p1_top = tk.Frame(self.TNbk1_t1)self.p1_top.place(relx=0.0, rely=0.0, relheight=0.138, relwidth=1.005)self.p1_top.configure(relief='groove')self.p1_top.configure(borderwidth="2")self.p1_top.configure(relief="groove")self.p1_top.configure(background="#d9d9d9")self.p1_top.configure(highlightbackground="#d9d9d9")self.p1_top.configure(highlightcolor="black")self.p1_left = tk.Frame(self.TNbk1_t1)self.p1_left.place(relx=0.0, rely=0.128, relheight=0.862, relwidth=0.907)self.p1_left.configure(relief='groove')self.p1_left.configure(borderwidth="2")self.p1_left.configure(relief="groove")self.p1_left.configure(background="#d9d9d9")self.p1_left.configure(highlightbackground="#d9d9d9")self.p1_left.configure(highlightcolor="black")self.p1_right = tk.Frame(self.TNbk1_t1)self.p1_right.place(relx=0.902, rely=0.128, relheight=0.862, relwidth=0.135)self.p1_right.configure(relief='groove')self.p1_right.configure(borderwidth="2")self.p1_right.configure(relief="groove")self.p1_right.configure(background="#d9d9d9")self.p1_right.configure(highlightbackground="#d9d9d9")self.p1_right.configure(highlightcolor="black")self.p2_left = tk.Frame(self.TNbk1_t2)self.p2_left.place(relx=0.0, rely=0.0, relheight=1.011, relwidth=0.103)self.p2_left.configure(relief='groove')self.p2_left.configure(borderwidth="2")self.p2_left.configure(relief="groove")self.p2_left.configure(background="#d9d9d9")self.p2_left.configure(highlightbackground="#d9d9d9")self.p2_left.configure(highlightcolor="black")self.p2_right = tk.Frame(self.TNbk1_t2)self.p2_right.place(relx=0.098, rely=0.0, relheight=0.989, relwidth=0.897)self.p2_right.configure(relief='groove')self.p2_right.configure(borderwidth="2")self.p2_right.configure(relief="groove")self.p2_right.configure(background="#d9d9d9")self.p2_right.configure(highlightbackground="#d9d9d9")self.p2_right.configure(highlightcolor="black")
if __name__ == '__main__':vp_start_gui()

第二个工具:VisualTkinter。是一个VB的插件。可以将VB的界面生成python tkinter代码。做个简单的界面用这个感觉不错。

这是一段生成一个菜单的代码。

#!/usr/bin/env python
#-*- coding:utf-8 -*-import os, sys
from tkinter import *
from tkinter.font import Font
from tkinter.ttk import *
#Usage:showinfo/warning/error,askquestion/okcancel/yesno/retrycancel
from tkinter.messagebox import *
#Usage:f=tkFileDialog.askopenfilename(initialdir='E:/Python')
#import tkinter.filedialog as tkFileDialog
#import tkinter.simpledialog as tkSimpleDialog  #askstring()class Application_ui(Frame):#这个类仅实现界面生成功能,具体事件处理代码在子类Application中。def __init__(self, master=None):Frame.__init__(self, master)self.master.title('Form1')self.master.geometry('1100x482')self.createWidgets()def createWidgets(self):self.top = self.winfo_toplevel()self.style = Style()self.MainMenu = Menu(self.top, tearoff=0)self.j = Menu(self.MainMenu, tearoff=0)self.j.add_command(label='最新', command=self.jx_Cmd)self.j.add_command(label='最热', command=self.hot_Cmd)self.MainMenu.add_cascade(menu=self.j, label='精选')self.zt = Menu(self.MainMenu, tearoff=0)self.zt.add_command(label='经典', command=self.jd_Cmd)self.zt.add_command(label='轻音乐', command=self.qinyy_Cmd)self.zt.add_command(label='怀旧', command=self.huijiu_Cmd)self.zt.add_command(label='抖音', command=self.dy_Cmd)self.zt.add_command(label='古风', command=self.gufen_Cmd)self.zt.add_command(label='网络', command=self.wangluo_Cmd)self.zt.add_command(label='游戏', command=self.youxi_Cmd)self.zt.add_command(label='影视', command=self.yinshi_Cmd)self.zt.add_command(label='佛乐', command=self.fuyv_Cmd)self.zt.add_command(label='网红', command=self.wanghong_Cmd)self.zt.add_command(label='纯音乐', command=self.congyy_Cmd)self.zt.add_command(label='ACG', command=self.ACG_Cmd)self.zt.add_command(label='3D', command=self.D3_Cmd)self.zt.add_command(label='KTV', command=self.ktv_Cmd)self.zt.add_command(label='器乐', command=self.qiyue_Cmd)self.zt.add_command(label='翻唱', command=self.fancang_Cmd)self.zt.add_command(label='喊麦', command=self.hanmai_Cmd)self.zt.add_command(label='店铺专用', command=self.dianpu_Cmd)self.MainMenu.add_cascade(menu=self.zt, label='主题')self.x = Menu(self.MainMenu, tearoff=0)self.x.add_command(label='伤感', command=self.shanggan_Cmd)self.x.add_command(label='放松', command=self.fangsong_Cmd)self.x.add_command(label='励志', command=self.lizhi_Cmd)self.x.add_command(label='开心', command=self.kaixing_Cmd)self.x.add_command(label='甜蜜', command=self.tianmi_Cmd)self.x.add_command(label='兴奋', command=self.xingfen_Cmd)self.x.add_command(label='安静', command=self.anjing_Cmd)self.x.add_command(label='治愈', command=self.zhiyu_Cmd)self.x.add_command(label='寂寞', command=self.jimo_Cmd)self.x.add_command(label='思念', command=self.sinian_Cmd)self.MainMenu.add_cascade(menu=self.x, label='心情')self.cj = Menu(self.MainMenu, tearoff=0)self.cj.add_command(label='开车', command=self.kaiche_Cmd)self.cj.add_command(label='运动', command=self.yundong_Cmd)self.cj.add_command(label='睡前', command=self.shuiqian_Cmd)self.cj.add_command(label='跳舞', command=self.tiaowu_Cmd)self.cj.add_command(label='学习', command=self.xuexi_Cmd)self.cj.add_command(label='清晨', command=self.qingchen_Cmd)self.cj.add_command(label='夜店', command=self.yandian_Cmd)self.cj.add_command(label='校园', command=self.xiaoyuan_Cmd)self.cj.add_command(label='咖啡店', command=self.kafeidian_Cmd)self.cj.add_command(label='旅行', command=self.lvxing_Cmd)self.cj.add_command(label='工作', command=self.gongzuo_Cmd)self.cj.add_command(label='广场舞', command=self.guangchuangwu_Cmd)self.MainMenu.add_cascade(menu=self.cj, label='场景')self.nd = Menu(self.MainMenu, tearoff=0)self.nd.add_command(label='70后', command=self.h70_Cmd)self.nd.add_command(label='80垢', command=self.h80_Cmd)self.nd.add_command(label='90后', command=self.h90_Cmd)self.nd.add_command(label='00后', command=self.h00_Cmd)self.nd.add_command(label='10后', command=self.h10_Cmd)self.MainMenu.add_cascade(menu=self.nd, label='年代')self.qf = Menu(self.MainMenu, tearoff=0)self.qf.add_command(label='流行', command=self.liuxin_Cmd)self.qf.add_command(label='电子', command=self.dianzi_Cmd)self.qf.add_command(label='摇滚', command=self.yaoguong_Cmd)self.qf.add_command(label='民歌', command=self.minge_Cmd)self.qf.add_command(label='民谣', command=self.migyao_Cmd)self.qf.add_command(label='古典', command=self.gudian_Cmd)self.qf.add_command(label='嘻哈', command=self.xiha_Cmd)self.qf.add_command(label='乡村', command=self.xiangcun_Cmd)self.qf.add_command(label='爵士', command=self.jueshi_Cmd)self.qf.add_command(label='R&B', command=self.rb_Cmd)self.MainMenu.add_cascade(menu=self.qf, label='曲风')self.yy = Menu(self.MainMenu, tearoff=0)self.yy.add_command(label='华语', command=self.huanyu_Cmd)self.yy.add_command(label='欧美', command=self.oumei_Cmd)self.yy.add_command(label='韩语', command=self.hanyv_Cmd)self.yy.add_command(label='粤语', command=self.yueyu_Cmd)self.yy.add_command(label='日语', command=self.riyv_Cmd)self.yy.add_command(label='小语种', command=self.xiaoyuzhong_Cmd)self.MainMenu.add_cascade(menu=self.yy, label='语言')self.aboutme = Menu(self.MainMenu, tearoff=0)self.aboutme.add_command(label='使用说明', command=self.abouthelp_Cmd)self.aboutme.add_command(label='关于', command=self.aboutver_Cmd)self.MainMenu.add_cascade(menu=self.aboutme, label='帮助')self.top['menu'] = self.MainMenuclass Application(Application_ui):#这个类实现具体的事件处理回调函数。界面生成代码在Application_ui中。def __init__(self, master=None):Application_ui.__init__(self, master)def jx_Cmd(self, event=None):#TODO, Please finish the function here!passdef hot_Cmd(self, event=None):#TODO, Please finish the function here!passdef jd_Cmd(self, event=None):#TODO, Please finish the function here!passdef qinyy_Cmd(self, event=None):#TODO, Please finish the function here!passdef huijiu_Cmd(self, event=None):#TODO, Please finish the function here!passdef dy_Cmd(self, event=None):#TODO, Please finish the function here!passdef gufen_Cmd(self, event=None):#TODO, Please finish the function here!passdef wangluo_Cmd(self, event=None):#TODO, Please finish the function here!passdef youxi_Cmd(self, event=None):#TODO, Please finish the function here!passdef yinshi_Cmd(self, event=None):#TODO, Please finish the function here!passdef fuyv_Cmd(self, event=None):#TODO, Please finish the function here!passdef wanghong_Cmd(self, event=None):#TODO, Please finish the function here!passdef congyy_Cmd(self, event=None):#TODO, Please finish the function here!passdef ACG_Cmd(self, event=None):#TODO, Please finish the function here!passdef D3_Cmd(self, event=None):#TODO, Please finish the function here!passdef ktv_Cmd(self, event=None):#TODO, Please finish the function here!passdef qiyue_Cmd(self, event=None):#TODO, Please finish the function here!passdef fancang_Cmd(self, event=None):#TODO, Please finish the function here!passdef hanmai_Cmd(self, event=None):#TODO, Please finish the function here!passdef dianpu_Cmd(self, event=None):#TODO, Please finish the function here!passdef shanggan_Cmd(self, event=None):#TODO, Please finish the function here!passdef fangsong_Cmd(self, event=None):#TODO, Please finish the function here!passdef lizhi_Cmd(self, event=None):#TODO, Please finish the function here!passdef kaixing_Cmd(self, event=None):#TODO, Please finish the function here!passdef tianmi_Cmd(self, event=None):#TODO, Please finish the function here!passdef xingfen_Cmd(self, event=None):#TODO, Please finish the function here!passdef anjing_Cmd(self, event=None):#TODO, Please finish the function here!passdef zhiyu_Cmd(self, event=None):#TODO, Please finish the function here!passdef jimo_Cmd(self, event=None):#TODO, Please finish the function here!passdef sinian_Cmd(self, event=None):#TODO, Please finish the function here!passdef kaiche_Cmd(self, event=None):#TODO, Please finish the function here!passdef yundong_Cmd(self, event=None):#TODO, Please finish the function here!passdef shuiqian_Cmd(self, event=None):#TODO, Please finish the function here!passdef tiaowu_Cmd(self, event=None):#TODO, Please finish the function here!passdef xuexi_Cmd(self, event=None):#TODO, Please finish the function here!passdef qingchen_Cmd(self, event=None):#TODO, Please finish the function here!passdef yandian_Cmd(self, event=None):#TODO, Please finish the function here!passdef xiaoyuan_Cmd(self, event=None):#TODO, Please finish the function here!passdef kafeidian_Cmd(self, event=None):#TODO, Please finish the function here!passdef lvxing_Cmd(self, event=None):#TODO, Please finish the function here!passdef gongzuo_Cmd(self, event=None):#TODO, Please finish the function here!passdef guangchuangwu_Cmd(self, event=None):#TODO, Please finish the function here!passdef h70_Cmd(self, event=None):#TODO, Please finish the function here!passdef h80_Cmd(self, event=None):#TODO, Please finish the function here!passdef h90_Cmd(self, event=None):#TODO, Please finish the function here!passdef h00_Cmd(self, event=None):#TODO, Please finish the function here!passdef h10_Cmd(self, event=None):#TODO, Please finish the function here!passdef liuxin_Cmd(self, event=None):#TODO, Please finish the function here!passdef dianzi_Cmd(self, event=None):#TODO, Please finish the function here!passdef yaoguong_Cmd(self, event=None):#TODO, Please finish the function here!passdef minge_Cmd(self, event=None):#TODO, Please finish the function here!passdef migyao_Cmd(self, event=None):#TODO, Please finish the function here!passdef gudian_Cmd(self, event=None):#TODO, Please finish the function here!passdef xiha_Cmd(self, event=None):#TODO, Please finish the function here!passdef xiangcun_Cmd(self, event=None):#TODO, Please finish the function here!passdef jueshi_Cmd(self, event=None):#TODO, Please finish the function here!passdef rb_Cmd(self, event=None):#TODO, Please finish the function here!passdef huanyu_Cmd(self, event=None):#TODO, Please finish the function here!passdef oumei_Cmd(self, event=None):#TODO, Please finish the function here!passdef hanyv_Cmd(self, event=None):#TODO, Please finish the function here!passdef yueyu_Cmd(self, event=None):#TODO, Please finish the function here!passdef riyv_Cmd(self, event=None):#TODO, Please finish the function here!passdef xiaoyuzhong_Cmd(self, event=None):#TODO, Please finish the function here!passdef abouthelp_Cmd(self, event=None):#TODO, Please finish the function here!passdef aboutver_Cmd(self, event=None):#TODO, Please finish the function here!passif __name__ == "__main__":top = Tk()Application(top).mainloop()try: top.destroy()except: pass

第三。网上还有一个用易语言做的工具,python Tkinter GUI可视化助手。如果想学习自己搜索吧。
懒得去学了。简单的界面使用 the page 和 VisualTkinter 这两个就够了。
再复杂的界面学习其他的模块如:wxPython/PyQt 。

python tkinter界面可视化工具相关推荐

  1. python五种可视化工具及六道常见面试题

    2017-12-26  吊炸天的  [Python五种可视化工具] 在 Python 中,将数据可视化有多种选择,正是因为这种多样性,何时选用何种方案才变得极具挑战性.本文包含了一些较为流行的工具以及 ...

  2. python电脑推荐_6款Python必备的可视化工具推荐

    想像阅读书本一样阅读数据流?这只有在电影中才有可能发生. 在现实世界中,企业必须使用数据可视化工具来读取原始数据的趋势和模式.尽管实际上存在着无数专门用于大数据可视化的工具,且它们都是既开源又专有的, ...

  3. python可视化工具好用_6款Python必备的可视化工具推荐

    想像阅读书本一样阅读数据流?这只有在电影中才有可能发生. 在现实世界中,企业必须使用数据可视化工具来读取原始数据的趋势和模式.尽管实际上存在着无数专门用于大数据可视化的工具,且它们都是既开源又专有的, ...

  4. Python+Tkinter 密保小工具

    上图 代码 核心 编解码方面 Tkinter界面更新 总结 昨天被一同学告知,网上的一个QQ密码库中有我的一条记录,当时我就震惊了,赶紧换了密码.当然了,这件事也给了我一个警示,那就是定期的更换自己的 ...

  5. python tkinter界面 控件位置随窗体自动调整适应_如何实现python tkinter控件随窗口变化?...

    不管是对于Java还是对于Python,我们最开始学习的时候,都会碰到关于开发上的窗口设置,如果不设置这个内容,你所呈现的项目效果,是非常不美观的,而往往为了符合美化,大家都会花费很多心思在基础的窗口 ...

  6. python tkinter界面基础----文艺范儿

    目录 文章目录 目录 tkinter界面 thinter 控件 公用属性 几何管理 简单应用 Lable 和 Button控件 Entry 和 Text控件 Listbox 选择列表 Radiobut ...

  7. python tkinter界面布局,python图形界面tkinter布局那些事

    布局 任何界面都有自己的布局风格,有些是横向布局,有些是纵向布局,有些是流水布局,还有些是网格布局,总之布局就是一种考虑如何放置元素或者组件的一种说明方式. 包裹(包装)布局 thinter中使用pa ...

  8. python tkinter 单位转换工具

    文章目录 前言 一.最终效果 二.设计思路 1.整体布局 2.布局代码 三.整体逻辑 3.1单位类型选择 3.2 单位转换 3.2.1 体积单位转换 3.2.2 面积单位转换 3.2.3 长度单位转换 ...

  9. Python代码在线可视化工具

           对于初学编程的同学或者运行他人写的代码程序时,相信很多小伙伴都会都会丈二和尚,摸不着头脑,根本看不懂代码写的是什么?为什么要这样写?代码是如何运行的?针对这一系列问题代码可视化工具应运而 ...

  10. 『数据可视化』基于Python的数据可视化工具

    刘宇宙,现在一家创业型公司做技术总负责,做爬虫和数据处理相关工作,曾从事过卡系统研发.金融云计算服务系统研发,物联网方向大数据研发,著书一本,<Python3.5从零开始学> 如何做Pyt ...

最新文章

  1. 【进阶4-1期】详细解析赋值、浅拷贝和深拷贝的区别
  2. linux 非交互ssh sshpass简介
  3. 《那些年啊,那些事——一个程序员的奋斗史》——59
  4. 前端开发代码架构相关想法
  5. SAP Spartacus OccEndpointsService单元测试的依赖注入
  6. 通过select选项动态异步加载内容
  7. 社区团购“九不得”:低价倾销、大数据“杀熟”被禁止
  8. php 编译记录文件,php-7.1编译记录
  9. GitLab Elasticsearch 私密群组数据泄露 bug 值3000美元
  10. 【转】关于浮点数的精度与取值范围的问题
  11. JS的 setTimeout 和 bind 使用 、复选框限制选定数据jq
  12. linux内核数据链路层,Linux网络内核数据帧的接收进程:数据链路层(概念篇)...
  13. 如何使用计算机勾绘汇水面积,水文计算算例
  14. 批量修改MP3文件信息
  15. Git使用学习(七、版本回滚)
  16. Altium Designer(AD)的简易使用
  17. linux安装系统如何查看硬盘,如何检查Linux系统服务器的硬盘是SSD还是HDD?
  18. Python27的安装
  19. Ubuntu中使用sanp一键安装安装Notepad ++
  20. 一次使用NodeJS实现网页爬虫记 - huanping - 博客园

热门文章

  1. day1 开始blog打卡之路
  2. 挺进商用车自动驾驶,德赛西威与MAXIEYE联合发布“九逵计划”
  3. Element 表单校验方法简单抽离
  4. matlab回文数,用Matlab求水花数-完美数-回文数和亲合数.doc
  5. 玻璃材料封接工艺技术介绍-电连接器封装形式
  6. DNS污染,配置DNS
  7. linux和window 双系统,如何构建 Linux 和 Windows 共存的双系统
  8. 堆、栈,队列,栈,树的个人理解和记录
  9. Flash制作雾效果
  10. centos 加密解密