Python GUI--Tkinter实践
之前写了Testlink自动执行程序,现使用Tkinter加上GUI试试,想要实现如下图功能
可以实现通过选择要执行的url及报告url自动执行用例,或可以直接写报告结果内容


因项目原因,只列出部分代码功能
from Tkinter import *
from SimpleDialog import *
from tkFileDialog import askopenfilename root = Tk()
root.title("TestLink自动执行")
root.resizable(False, False) #让窗口不可以缩放 '''
增加变量
'''
addvar=StringVar()
vv=StringVar()
vv.set('已执行完的测试报告:')
v=StringVar() '''
增加label及text
''' urladdress=Label(root,text='TestLink地址:')
urladdress.grid(row=0,sticky=W)
address=Entry(root,text='input you text here',textvariable = addvar)
address.grid(row=0,column=1,sticky=E) user=Label(root,text='登陆用户名:')
user.grid(row=1,sticky=W) usertext=Entry(root,text='input you user here')
usertext.grid(row=1,column=1,sticky=E) Label(root,text='登陆密码:').grid(row=2,sticky=W)
password=Entry(root,text='Input you passowrd here')
password.grid(row=2,column=1,sticky=E) Label(root,text='测试项目关键字:').grid(row=3,sticky=W)
testproject=Entry(root,text='Input you testprojectid here')
testproject.grid(row=3,column=1,sticky=E) Label(root,text='测试计划关键字:').grid(row=4,sticky=W)
testplan=Entry(root,text='Input you testplanid here')
testplan.grid(row=4,column=1,sticky=E) planurl=StringVar()
Label(root,text='需要执行的测试计划:').grid(row=5,sticky=W)
testplanurl=Entry(root,text='Input you testplanurl here',textvariable = planurl)
testplanurl.grid(row=5,column=1,sticky=E) choseplan=Button(root,text='选择')
choseplan.grid(row=5,column=1,sticky=E) reporturl=StringVar()
report=Label(root,textvariable=vv,text="已执行完的测试报告:")
report.grid(row=6,sticky=W)
reportentry=Entry(root,textvariable = reporturl)
reportentry.grid(row=6,column=1,sticky=E) chosereport=Button(root,text='选择')
chosereport.grid(row=6,column=1,sticky=E) addvar.set('http://192.168.3.247:8080/testlink/login.php') def planopen(event): global filename
filename=askopenfilename()
if filename=="":
filename=None
else:
root.title("xxxx"+os.path.basename(filename))
pathdir=os.path.abspath(filename)
if "http://" not in pathdir:
pathdir="file:///"+pathdir
planurl.set(pathdir) def reportopen(event):
global filename
filename=askopenfilename()
try:
if filename=="":
filename=None
else:
root.title("xxxx"+os.path.basename(filename))
pathdir=os.path.abspath(filename)
if "http://" not in pathdir:
pathdir="file:///"+pathdir
reporturl.set(pathdir)
#return os.path.abspath(filename)
except Exception,e:
print e choseplan.bind("<Button-1>",planopen)
chosereport.bind("<Button-1>",reportopen) start=Button(root,text='开始')
stop=Button(root,text='停止')
chose=Checkbutton(root,text='通过报告写结果',variable=v,command=callCheckbutton,onvalue="已执行完的测试报告:",offvalue="直接写结果:")
#b2.bind("<Return>", cb2) #建立事件与响应函数之间的关系,每当产生Return事件后,程序调用cb2 start.grid(row=7)
stop.grid(row=7,sticky=E)
chose.grid(row=7,sticky=E,column=1)
start.bind('<Button-1>', printc)
stop.bind("<Button-1>",execut) var = StringVar()
lb2 = Listbox(root, listvariable = var) s1=Scrollbar(root)
lb2.grid(row=8,columnspan = 2,sticky=E+W)
s1.grid(row=8,columnspan = 2,rowspan=5,sticky=N+E+S) lb2['yscrollcommand']=s1.set
s1['command']=lb2.yview root.columnconfigure(0,minsize = 10)
root.mainloop()
Python GUI--Tkinter实践的更多相关文章
- Python GUI - Tkinter tkMessageBox
Python GUI - Tkinter tkMessageBox: tkMessageBox模块用于显示在您的应用程序的消息框.此模块提供了一个功能,您可以用它来显示适当的消息 tkMess ...
- Python GUI编程实践
看完了<python编程实践>对Python的基本语法有了一定的了解,加上认识到python在图形用户界面和数据库支持方面快捷,遂决定动手实践一番. 因为是刚接触Python,对于基本的数 ...
- Python GUI - tkinter
目录: Tkinter 组件 标准属性 几何管理 代码实例: 1. Label & Button 2. Entry & Text 3.Listbox列表 4.Radiobutton单选 ...
- python gui tkinter快速入门教程 | python tkinter tutorial
本文首发于个人博客https://kezunlin.me/post/d5c57f56/,欢迎阅读最新内容! python tkinter tutorial Guide main ui messageb ...
- Python GUI——tkinter菜鸟编程(中)
8. Radiobutton 选项按钮:可以用鼠标单击方式选取,一次只能有一个选项被选取. Radiobutton(父对象,options,-) 常用options参数: anchor,bg,bitm ...
- python gui tkinter用法杂记
1.treeview遍历 iids = tree.selection() t = tree.get_children() for i in t: print(tree.item(i,'values') ...
- Python GUI tkinter 学习笔记(一)
第一个python程序 #!/usr/bin/python # -*- coding: UTF-8 -*- from Tkinter import * # 创建一个根窗口,其余的控件都在这个窗口之上 ...
- Python GUI tkinter 学习笔记(三)
草稿 # -*- coding: utf-8 -*- from Tkinter import * root = Tk() Label(root, text = "First").g ...
- Python GUI tkinter 学习笔记(二)
第二个程序 # -*- coding: utf-8 -*- from Tkinter import * class App: def __init__(self, master): # frame 创 ...
- python GUI实战项目——tkinter库的简单实例
一.项目说明: 本次通过实现一个小的功能模块对Python GUI进行实践学习.项目来源于软件制造工程的作业.记录在这里以复习下思路和总结编码过程.所有的源代码和文件放在这里: 链接: https:/ ...
随机推荐
- Java实现一个简单的缓存方法
缓存是在web开发中经常用到的,将程序经常使用到或调用到的对象存在内存中,或者是耗时较长但又不具有实时性的查询数据放入内存中,在一定程度上可以提高性能和效率.下面我实现了一个简单的缓存,步骤如下. 创 ...
- msyql 笔记
mysql复习 一:复习前的准备 1:确认你已安装wamp 2:确认你已安装ecshop,并且ecshop的数据库名为shop 二 基础知识: 1.数据库的连接 mysql -u -p -h -u 用 ...
- smo算法
文章在word里写好了,公式没法贴到论坛里,所以直接截图了
- MapReduce调度与执行原理系列文章
转自:http://blog.csdn.net/jaytalent?viewmode=contents MapReduce调度与执行原理系列文章 一.MapReduce调度与执行原理之作业提交 二.M ...
- (转)MFC的ClistCtrl删除选中多行项目
MFC的ClistCtrl控件添加了多行数据后,若要删除选中的多行数据,可以使用ClistCtrl的成员函数,在网上找了很多例子,发现都有问题,因为在删除ClistCtrl行的时候,删除行下面的行会上 ...
- php -- 检查是否存在
1.检查变量是否存在:isset() 2.检查常量是否存在:defined() 3.检查方法是否存在:function_exists() 4.检查类是否存在:class_exists()
- react新手入门(序)
之前在软件园使用的是react,当时为了做个集光推送,自己去搭过react,这次项目中继续使用react,于是又重新操作了遍,恰巧公司买了本react的书籍,这本书写的非常好,看着并不觉得拗口,很容易 ...
- 【Java面试题】10 abstract的method是否可同时是static,是否可同时是native,是否可同时是synchronized?
1.abstract是抽象的,指的是方法只有声明而没有实现,他的实现要放入声明该类的子类中实现. 2.static是静态的,是一种属于类而不属于对象的方法或者属性 3.synchronized 是同步 ...
- u3d发布成全屏的方式
using UnityEngine; using System.Collections; public class example : MonoBehaviour { public voi ...
- 制作SD卡启动自己编译的uboot.bin
README for FriendlyARM Tiny4412 -----------------------------------------------------1. Build uboot ...