展开全部

有什么问题吗32313133353236313431303231363533e78988e69d8331333361303038 ,刚好之前写过一些关于py3 tk的东西,可以一起探讨一下,给你一个例子:import urllib, urllib.request

import os, re

from tkinter import *

import tkinter.ttk

import ctypes

import threading, time

def RunApp():

handler = None;

operator = "open";

fpath = "D:\SoftWare\Chrome\Chrome\chrome.exe";

param = '-user-data-dir="D:\SoftWare\Chrome\profil';

dirpath = 'D:\SoftWare\Chrome\Chrome';

ncmd = 1;

shell32 = ctypes.windll.LoadLibrary("shell32.dll");

shell32.ShellExecuteW(handler,operator,fpath,param,dirpath,ncmd);

def callbackfunc(blocknum, blocksize, totalsize):

'''回调函数

@blocknum: 已经下载的数据块

@blocksize: 数据块的大小

@totalsize: 远程文件的大小

'''

percent = 100.0 * blocknum * blocksize / totalsize

if percent > 100:

percent = 100

prb['value'] = percent

lbjd['text'] = '更新进度 %0.2f ' % percent + '%'

#print(percent)

def prbadd():

prb['value'] += 1

def Load():

time.sleep(0.5)

t1 = threading.Thread(target=down)

t1.start()

def down():

nfn = vel+'_chrome_installer.exe'

print('hehe')

urllib.request.urlretrieve(link,nfn,callbackfunc)

os.system('update.bat '+nfn)

#print('更新完成')

#os.system('PAUSE')

#os.system('''start D:\SoftWare\Chrome\Chrome\chrome.exe -user-data-dir="D:\SoftWare\Chrome\profil"''')

RunApp()

root.quit()

html = urllib.request.urlopen('http://down.tech.sina.com.cn/page/40975.html').read().decode('gbk')

t = re.search('(?<=down_load_url" href=")[^"]+(?=" target="_blank" class="f14b">正式版-)',html)

link = 'http://down.tech.sina.com.cn' + t.group(0)

title = html[html.index('

') + 7 : html.index('')]

vel = title[title.rindex('/')+1:title.index('】') - 3]

ls = os.listdir('../Chrome/')

for fn in ls:

if fn.find('exe') == -1:

oldvel = fn

break

if oldvel != vel:

root = Tk()

root.title('Chrome更新工具')

# root.attributes("-toolwindow", 1)

lbjd = Label(root,text='更新进度')

lbjd.pack()

prb = tkinter.ttk.Progressbar(root, length=400, maximum=100.0, value=0)

prb.pack()

sw = root.winfo_screenwidth()

sh = root.winfo_screenheight()

root.geometry('410x50+'+str(int((sw-410)/2))+'+'+str(int((sh-50)/2)))

#root.bind('',Load)

Load()

root.mainloop()

else:

#print('已经是最新版本')

RunApp()

#os.system('''start D:\SoftWare\Chrome\Chrome\chrome.exe -user-data-dir="D:\SoftWare\Chrome\profil"''')

#print(title)

这个是我自己更新chrome用的

python中tk的用法_python3.0 tk的使用相关推荐

  1. python中tile的用法_python3中numpy函数tile的用法详解

    tile函数位于python模块 numpy.lib.shape_base中,他的功能是重复某个数组.比如tile(A,n),功能是将数组A重复n次,构成一个新的数组,我们还是使用具体的例子来说明问题 ...

  2. python中goto的用法_python3里用goto

    python里用goto也是小Pa最近做的项目里的一个需求.python不像C有自带的goto, 需要用额外的包,目前为止,小pa只看到2个goto的包: 这2个小Pa都下载试用过,goto因为开发的 ...

  3. python中max函数用法_python3 内置函数——max()函数

    max()作用: 得到多个参数中最大的值 max()函数注意: 1.max()函数处理的是可迭代对象,相当于一个for循环取出每个元素进行比较,注意,不同类型之间不能进行比较. 2.每个元素间进行比较 ...

  4. python中choice的用法_Python3 choice 函数

    choice() 方法从列表,元组或字符串中返回一个随机的项目. 语法 以下是 choice() 方法的语法: choice( seq ) 注:此函数无法直接访问,所以我们需要导入 random 模块 ...

  5. 五分钟理解yield在python中的简单用法,让你不再迷惑

    很多同学无论是在学习python还是使用python的过程中,都会遇到yield关键字,这个让人头大的问题,今天,就给大家分享一下我自学yield的心路历程 基本概念: (1)在 Python 中,使 ...

  6. format函数python的顺序_[转载] Python中format函数用法

    Python中format函数用法 format优点 format是python2.6新增的格式化字符串的方法,相对于老版的%格式方法,它有很多优点. 1.不需要理会数据类型的问题,在%方法中%s只能 ...

  7. 详解python中的用法_详解python中*号的用法

    1.表示乘号 2.表示倍数,例如: def T(msg,time=1): print((msg+' ')*time) T('hi',3) 打印结果(打印3次): hi hi hi 3.单个 * (1) ...

  8. Python中的del用法

    python中的del用法比较特殊,新手学习往往产生误解,弄清del的用法,可以帮助深入理解python的内存方面的问题. python的del不同于C的free和C++的delete. 由于pyth ...

  9. python中argv的用法

    python中argv的用法 sys.argv可以用来获取命令行参数,其中sys.argv[0]为脚本名,即python文件名,列表中的其他值为传入的参数值,一般定义方式为 script, arg1, ...

最新文章

  1. bzoj 4602: [Sdoi2016]齿轮
  2. linux 图形界面 x x11 gnome xorg kde 之间的关系
  3. 0027-如何在CDH集群启用Kerberos
  4. EAGLView介绍
  5. P5708 【深基2.习2】三角形面积【入门题】
  6. mysql错误码 1045_MySql错误代码1045的解决方法
  7. c html 转换 pdf文件,Html2Pdf:C调用wkhtmltopdf的API来将Html转换为pdf文件
  8. 蓝桥杯 ADV-169 算法提高 士兵排队问题
  9. java byte to integer_Java中的Byte转为无符号的Integer
  10. Intellij IDEA 看源码必备的技能!
  11. 个人量化交易初探之一(数据的爬取)
  12. windows下 C++ openCV配置及x86编译(傻瓜式教程)
  13. 对称与非对称加密算法
  14. 短信通道——阿里大鱼(java)
  15. 【CSS】文字超过三行显示省略号...
  16. RHCE 第二周作业
  17. 如何更改MindMapper中的默认样式
  18. SSL数字证书(一)CA、根证书与数字证书
  19. vsftpd之主动模式 被动模式
  20. Linux_cmd_basic

热门文章

  1. Centos 防火墙介绍
  2. 二、何为Spring Boot整合Spring Cloud?
  3. 网站优化SEO关于TDK以及ALT标签的设置点
  4. Android手机修改hosts文件
  5. Java中序列化实现原理研究
  6. 《游戏脚本的设计与开发》-(RPG部分)3.1 RPG地图到底怎么做?
  7. python爬取4k高清壁纸(再也不怕没有壁纸了)
  8. 在项目中单元测试是用来做什么的?
  9. Office365 - 如何查询email是否发送成功
  10. 基于STM32设计的指针式电子钟与万年历