import tkinter as tk

class APP:
def __init__(self,master):
frame = tk.Frame(master)
frame.pack(side = tk.LEFT,padx=50,pady=50) self.hi_there = tk.Button(frame,text ="打招呼",bg = "blue",fg = "white",command = self.say_hi)
self.hi_there.pack() def say_hi(self):
print("Hello World!") root = tk.Tk()
app = APP(root) root.mainloop()
from tkinter import*
def callback():
var.set("No!")
root = Tk() frame1 = Frame(root)
frame2 = Frame(root)
var = StringVar()
var.set("Sorry!\nThere is someting Wrong!") textLabel = Label(frame1,
textvariable = var,
justify = LEFT)
textLabel.pack(side=LEFT) photo = PhotoImage(file = "18.gif")
imLabel = Label(frame1,image = photo)
imLabel.pack(side = LEFT) theButton = Button(frame2,text = "I am OK !",command = callback)
theButton.pack() '''
photo = PhotoImage(file = "bg.gif")
theLabel = Label(root,
text = "学 Python\n到 FichC",
justify = LEFT,
image = photo,
compound = CENTER,
fg = "white")
theLabel.pack()
'''
frame1.pack(padx = 10,pady = 10)
frame2.pack(padx = 10,pady = 10)
mainloop()

Tkinter 小应用的更多相关文章

  1. 1 TKinter小窗口及标题

    说明 :本博客户关于tkinter的知识参考:2014 年辛星 Python 界面编程教程第二版 创建一个GUI程序的步骤: 创建一个GUI程序 1.导入Tkinter模块 2.创建控件 3.指定这个 ...

  2. 【python基础】 Tkinter小构件之canvas 画布

    [python之tkinter画布] 要画布就要使用tkinter的小构件,canvas(结构化的图形,用于绘制图形,创建图形编辑器以及实现自定制的小构件类) 我们先使用create_rectangl ...

  3. Python Tkinter小实例——模拟掷骰子

    什么是Tkinter? Tkinter 是 Python 的标准 GUI 库.Python 使用 Tkinter 可以快速的创建 GUI 应用程序. 由于 Tkinter 是内置到 python 的安 ...

  4. Tkinter小技巧:如何为窗口右上角的‘x’添加一个自定义的响应函数

    不废话,直接上代码 import tkinter as tk from tkinter import messagebox main_window = tk.Tk() main_window.geom ...

  5. python1 tkinter

    turtle 图形: turtle.color(c) 设置笔的颜色turtle.fillcolor(c) 设置笔填充颜色turtle.begin_fill()   在填充颜色前访问这个方法turtle ...

  6. python之tkinter学习目录

    前言 下面的目录结构,采用的学习视频资料是网易云课堂中[莫凡]老师的,在目录的最下面的地方给出了对应的链接! 学习是逐渐积累起来的,代码也是!下面的每一篇中的对应代码,都秉承着这样的一个理念:代码是成 ...

  7. Python GUI之Tkiner实战

    前言 Tkinter 是 Python 的标准 GUI 库.Python 使用 Tkinter 可以快速的创建 GUI 应用程序. 由于 Tkinter 是内置到 python 的安装包中.只要安装好 ...

  8. Python3的tkinter写一个简单的小程序

    一.这个学期开始学习python,但是看了python2和python3,最后还是选择了python3 本着熟悉python的原因,并且也想做一些小程序来增加自己对python的熟练度.所以写了一个简 ...

  9. Python+Tkinter 密保小工具

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

随机推荐

  1. UVA 11884 A Shooting Game(记忆化搜索)

    A and B are playing a shooting game on a battlefield consisting of square-shaped unit blocks. The bl ...

  2. 文件名的查找——find

    查找文件!!! 命令格式:find [PATH] [option] [action] 一.参数1——与时间有关的参数 -atime.-ctime.-mtime -mtime n:在n天之前的“一天之内 ...

  3. Spring 学习笔记(八)—— 注解使用整合

    @Autowired  —— 自动装配 需先在配置文件中,配置一个org.springframework.beans.factory.annotation. AutowiredAnnotationBe ...

  4. VirtualBox上安装ubuntu

    当安装完成,重启后,在启动界面出现Please remove the installation medium,then press ENTER.问题? 解决方法:在VirtualBox里面通过iso文 ...

  5. 【iOS开发】IOS界面开发使用viewWithTag:(int)findTag方法获取界面元素

    http://blog.csdn.net/lxp1021/article/details/43952551 今天在开发OS界面的时候,遇到通过界面UIview viewWithTag:(int)fin ...

  6. scrapy使用记录

    1 进入pip安装目录 python -m pip install --upgrade pip pip install Scrapy 2. 创建一个项目 scrapy startproject tes ...

  7. 【bzoj2006】[NOI2010]超级钢琴 倍增RMQ+STL-堆

    题目描述 小Z是一个小有名气的钢琴家,最近C博士送给了小Z一架超级钢琴,小Z希望能够用这架钢琴创作出世界上最美妙的音乐. 这架超级钢琴可以弹奏出n个音符,编号为1至n.第i个音符的美妙度为Ai,其中A ...

  8. 【bzoj2815】[ZJOI2012]灾难 拓扑排序+倍增LCA

    题目描述(转自洛谷) 阿米巴是小强的好朋友. 阿米巴和小强在草原上捉蚂蚱.小强突然想,果蚂蚱被他们捉灭绝了,那么吃蚂蚱的小鸟就会饿死,而捕食小鸟的猛禽也会跟着灭绝,从而引发一系列的生态灾难. 学过生物 ...

  9. something about Parameter Estimation (参数估计)

    点估计 Point Estimation 最大似然估计(Maximum Likelihood Estimate —— MLE):视θ为固定的参数,假设存在一个最佳的参数(或参数的真实值是存在的),目的 ...

  10. CCmdUI

    原文链接地址:http://blog.csdn.net/luicha/article/details/6771185 CCmdUI是一个只被使用于ON_UPDATECOMMAND_UI消息的响应函数中 ...