之前写了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实践的更多相关文章

  1. Python GUI - Tkinter tkMessageBox

    Python GUI - Tkinter tkMessageBox: tkMessageBox模块用于显示在您的应用程序的消息框.此模块提供了一个功能,您可以用它来显示适当的消息     tkMess ...

  2. Python GUI编程实践

    看完了<python编程实践>对Python的基本语法有了一定的了解,加上认识到python在图形用户界面和数据库支持方面快捷,遂决定动手实践一番. 因为是刚接触Python,对于基本的数 ...

  3. Python GUI - tkinter

    目录: Tkinter 组件 标准属性 几何管理 代码实例: 1. Label & Button 2. Entry & Text 3.Listbox列表 4.Radiobutton单选 ...

  4. python gui tkinter快速入门教程 | python tkinter tutorial

    本文首发于个人博客https://kezunlin.me/post/d5c57f56/,欢迎阅读最新内容! python tkinter tutorial Guide main ui messageb ...

  5. Python GUI——tkinter菜鸟编程(中)

    8. Radiobutton 选项按钮:可以用鼠标单击方式选取,一次只能有一个选项被选取. Radiobutton(父对象,options,-) 常用options参数: anchor,bg,bitm ...

  6. python gui tkinter用法杂记

    1.treeview遍历 iids = tree.selection() t = tree.get_children() for i in t: print(tree.item(i,'values') ...

  7. Python GUI tkinter 学习笔记(一)

    第一个python程序 #!/usr/bin/python # -*- coding: UTF-8 -*- from Tkinter import * # 创建一个根窗口,其余的控件都在这个窗口之上 ...

  8. Python GUI tkinter 学习笔记(三)

    草稿 # -*- coding: utf-8 -*- from Tkinter import * root = Tk() Label(root, text = "First").g ...

  9. Python GUI tkinter 学习笔记(二)

    第二个程序 # -*- coding: utf-8 -*- from Tkinter import * class App: def __init__(self, master): # frame 创 ...

  10. python GUI实战项目——tkinter库的简单实例

    一.项目说明: 本次通过实现一个小的功能模块对Python GUI进行实践学习.项目来源于软件制造工程的作业.记录在这里以复习下思路和总结编码过程.所有的源代码和文件放在这里: 链接: https:/ ...

随机推荐

  1. 在Ubuntu中安装PHP,MySQL,Nginx和phpMyAdmin

    apt install php apt-get install php7.0 apt-get -y install php7.0-fpm 缺少 mysqli 扩展.请检查 PHP 配置. apt in ...

  2. 20 个 jQuery 和 CSS 的文本特效插件

    Jumble Text Effect Plugins Demo || Download Vticker – Vertical News Ticker With JQuery Plugin Demo | ...

  3. php 不依赖数据实现删除图片,核心代码

    <?php $file = "ueditor\php\upload\image\*\*.png"; foreach (glob("$file") as $ ...

  4. 关于Cocos2d-x中init方法和onEnter方法的区别

    init()和onEnter()这两个方法都是写实例化对象的类(比如继承自Node的一些类等等)的时候用到的方法. 一般都是public类型下面的 bool init(); void onEnter( ...

  5. Maven中央仓库——你可能不知道的细节

    地址 —— 目前来说,http://repo1.maven.org/maven2/是真正的Maven中央仓库的地址,该地址内置在Maven的源码中,其它地址包括著名的ibiblio.org,都是镜像. ...

  6. android NavigationBar 显示

    android连接7inch屏时,虚拟按键会显示到右侧,变成一条黑边,并且只有back功能. 在连接10inch的时候,虚拟按键就正常,显示在屏幕的底部.有back,home,recent app三个 ...

  7. CentOS显示设置时间命令- date

    概要: date命令的功能是显示和设置系统日期和时间 命令格式: date [OPTION]... [+FORMAT]date [-u|--utc|--universal] [MMDDhhmm[[CC ...

  8. iOS 图文混排 (Swift版)

    // 0> 图片附件 let attachment = NSTextAttachment() attachment.image = #imageLiteral(resourceName: &qu ...

  9. centos7 修改主机名的方法(在centos7有效)

    参考链接:http://www.centoscn.com/CentOS/config/2014/1031/4039.html 在CentOS或RHEL中,有三种定义的主机名:a.静态的(static) ...

  10. Ubuntu:为 Firefox 浏览器 安装 flash 插件

    从adobe上下载浏览器flashplayer插件:推荐 x.tar.gz格式的——通用格式. 解压tar.gz后可以得到:libflashplayer.so 文件 将 libflashplayer. ...