Python主窗口

Python特定的GUI界面,是一个图像的窗口,tkinter是python自带的,可以编辑的GUI界面,我们可以用GUI实现很多一个直观的功能,如何想开发一个计算器,如果只是一个程序输入,输出窗口的话,是没用用户体验的。所有开发一个图像化的小窗口,就是必要的。

#coding=utf-8
import Tkinter as tk
def create_windows(fun):
def only_windows():
#第1步,建立窗口windows
windows = tk.Tk()
#第2步,给窗口的可视化起名字
windows.title("ryan")
#第三步,设定窗口的大小(长x宽)
windows.geometry("200x200")
#窗口大小是否可调,分别表示x,y方向的可变性:1表示可变,0表示不可变
windows.resizable(1,1)
#刷新页面
windows.update()
#内建带参数的装饰器
fun(windows)
#进入消息循环(必须步骤)
windows.mainloop()
return only_windows
@create_windows
def decorate_fun(windows):
pass
decorate_fun()

1、无核心组件的窗口

import Tkinter as tk
import os,datetime
def create_windows(fun):
def only_windows():
windows = tk.Tk()
windows.title("ryan")
windows.resizable(1,1)
windows.geometry("200x200")
windows.update()
fun(windows)
windows.mainloop()
return only_windows
@create_windows
def decorate_fun(windows):
in_put = tk.Entry(windows)
in_put.pack()
out_put = tk.Text(windows,height=4)
out_put.pack()
def inner_put():
var = in_put.get()
files = eval(var)
out_put.delete("1.0",tk.END)
out_put.insert("insert", files)
click_button = tk.Button(windows,text="insert",command=inner_put)
click_button.pack()
decorate_fun()

2、有核心组件的窗口

Python内建GUI模块Tkinter(一)的更多相关文章

  1. Python内建GUI模块Tkinter(二)

    Python核心组件 1.Button 按钮组件:一个简单的按钮,用来执行一个命令或别的操作. 参数解析: text:指定按钮上显示的文本: anchor: 指定按钮上文本的位置(N, NE, E, ...

  2. Python内置GUI模块Tkinter的几点笔记

    组件属性,用法 组件位置 更多

  3. python内建时间模块 time和datetime

    时间模块 UTC(Coordinated Universal Time,世界协调时)亦即格林威治天文时间,世界标准时间.在中国为UTC+8.DST(Daylight Saving Time)即夏令时. ...

  4. python内建datetime模块

    datetime 获取当前日期和时间 from datetime import datetime now = datetime.now() print(now) datetime转换为timestam ...

  5. Python内建模块--collections

    python内建模块--collections collections是Python内建的一个集合模块,提供了许多有用的集合类. namedtuple 我们知道tuple可以表示不变集合,例如,一个点 ...

  6. [pyhton]python内建方法

    撸一遍python的内建方法 这样做的好处就是:我如果要完成一个功能的时候,如果能用内建方法完成,就用内建方法.这样可以提高效率,同时使自己的代码更加优雅.哎呦?那岂不是撸完就是python高手了?我 ...

  7. Python自建logging模块

    本章将介绍Python内建模块:日志模块,更多内容请从参考:Python学习指南 简单使用 最开始,我们用最短的代码体验一下logging的基本功能. import logging logger = ...

  8. python内建的命名空间研究

    python内建的命名空间研究 说明: python内置模块的命名空间.python在启动的时候会自动为我们载入很多内置的函数.类,比如 dict,list,type,print,这些都位于 __bu ...

  9. Python自建collections模块

    本篇将学习python的另一个内建模块collections,更多内容请参考:Python学习指南 collections是Python内建的一个集合模块,提供了许多有用的集合类. namedtupl ...

随机推荐

  1. VMware(威睿)后端开发笔试题总结

    1.   Linux中查看系统的发行版本信息 的命令? cat/etc/issue    和    lsb_release 2.   linux 挂载一个共享文件夹: mount  -t  cifc ...

  2. UVA - 12169 -扩展欧几里得算法

    #include<iostream> #include<string.h> #include<algorithm> #include<stdio.h> ...

  3. 14-Requests+正则表达式爬取猫眼电影

    '''Requests+正则表达式爬取猫眼电影TOP100''''''流程框架:抓去单页内容:利用requests请求目标站点,得到单个网页HTML代码,返回结果.正则表达式分析:根据HTML代码分析 ...

  4. Git - 常见错误与解决方案

    1.windows使用git时出现:warning: LF will be replaced by CRLF 分析: windows中的换行符为 CRLF, 而在linux下的换行符为LF,所以在执行 ...

  5. PV、TPS、QPS计算公式(转)

    英文解释: PV=page viewTPS=transactions per secondQPS=queries per secondRPS=requests per second RPS=并发数/平 ...

  6. webdriver原理、协议

    1.webdriver client的原理是什么? 当测试脚本启动firefox的时候,selenium-webdriver 会首先在新线程中启动firefox浏览器.如果测试脚本指定了firefox ...

  7. C# List用法 List介绍

    一.#List泛型集合 集合是OOP中的一个重要概念,C#中对集合的全面支持更是该语言的精华之一. 为什么要用泛型集合? 在C# 2.0之前,主要可以通过两种方式实现集合: a.使用ArrayList ...

  8. JSON Support in PostgreSQL and Entity Framework

    JSON 和JSONB的区别(What's difference between JSON and JSONB data type in PosgresSQL?) When should be use ...

  9. shit iview docs & i-radio bug

    shit iview docs & i-radio bug https://github.com/iview/iview/issues/5627 <i-row> <i-col ...

  10. js auto hover button & html5 button autofocus

    js auto hover button & html5 button autofocus input // html 5 <input name="myinput" ...