Python_tkinter(4)_上传文件
1.上传单个文件
import tkinter as tk
from tkinter import filedialog def upload_file():
selectFile = tk.filedialog.askopenfilename() # askopenfilename 1次上传1个;askopenfilenames1次上传多个
entry1.insert(0, selectFile) root = tk.Tk() frm = tk.Frame(root)
frm.grid(padx='', pady='')
btn = tk.Button(frm, text='上传文件', command=upload_file)
btn.grid(row=0, column=0, ipadx='', ipady='', padx='', pady='')
entry1 = tk.Entry(frm, width='')
entry1.grid(row=0, column=1) root.mainloop()
运行结果如下
选择文件后
2.上传多个文件
import tkinter as tk
from tkinter import filedialog def upload_files():
selectFiles = tk.filedialog.askopenfilenames(
title='可选择1个或多个文件') # askopenfilename 1次上传1个;askopenfilenames1次上传多个
for selectFile in selectFiles:
text1.insert(tk.END, selectFile + '\n') # 更新text中内容
text1.update() root = tk.Tk() frm = tk.Frame(root)
frm.grid(padx='', pady='')
btn = tk.Button(frm, text='上传文件', command=upload_files)
btn.grid(row=0, column=0, ipadx='', ipady='', padx='', pady='')
text1 = tk.Text(frm, width='', height='')
text1.grid(row=0, column=1) root.mainloop()
运行效果:
Python_tkinter(4)_上传文件的更多相关文章
- AFNetworking框架_上传文件或图像server
的文本 XXXXXXXXXX在自己的论点更填写 - (void)uploadImageWithImage:(NSString *)imagePath { //上传其它所需參数 NSString *us ...
- apache_fileupload实现文件上传_上传多个文件
1.导包 核心类: DiskFileItemFactory – 设置磁盘空间,保存临时文件.只是一个具类. ServletFileUpload - 文件上传的核心类,此类接收request,并解析r ...
- 找呀志_通过开源框架引AsyncHttpClient上传文件
一个.步骤: 1.加入权限(接入网络和可写) 2.获取上传文件的路径和推断是空的 3.如果为空.创建一个异步请求对象 4.创建上传文件路径 5.跑post请求(指定url路径.封装上传參数.新建Asy ...
- php Socket模拟表单上传文件函数_学习
模拟上传文件的php代码 里面访问地址.主机.上传文件名.内容.分隔符可以修改 function postFile($file) { $clf = "\r\n"; ...
- 很方便的后台ajax上传文件
<a href="javascript:void(0);" url="{:U('teacherd?id='.$vo['id'])}" class=&quo ...
- Android上传文件至服务器(上)
每一次都不能上首页,真悲催..管理员让我上一次首页? 很多时候我更愿意一个人写代码,与其在垃圾代码上改改改,我更愿意直接重构. 整洁的代码简单直接.整洁的代码如同优美的散文.整洁的代码从不隐藏设计者的 ...
- 利用ThinkPHP自带的七牛云驱动上传文件到七牛云以及删除七牛云文件方法
一.准备工作 1.注册七牛云账号 2.选择对象储存->创建空间->设置为公开 3.在config配置文件中添加以下代码 'UPLOAD_FILE_QINIU' => array ( ...
- ueditor1.3.6jsp版在struts2应用中上传图片报"未找到上传文件"解决方案
摘要: ueditor1.3.6jsp版在struts2应用中上传图片报"未找到上传文件"解决方案 在struts2应用中使用ueditor富文本编辑器上传图片或者附件时,即使配置 ...
- angulaijs中的ng-upload-file与阿里云oss服务的结合,实现在浏览器端上传文件到阿里云(速度可以达到1.5M)
2015-10-26 angularjs结合aliyun浏览器端oos文件上传加临时身份验证例子 在服务端获取sts 源码: public class StsServiceSample { // 目前 ...
随机推荐
- NB卡开卡注意事项【转】
转自:https://blog.csdn.net/cheng401733277/article/details/83276436 版权声明:本文为博主原创文章,未经博主允许不得转载. https:// ...
- 【easy】695. Max Area of Island
题目: Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) ...
- 【原创】数据库基础之Mysql(2)主从库配置
一 安装 # wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm# yum -y insta ...
- 初学python之路-day03
我在前面的文章提到了变量的概念,这里详细介绍下变量的命名.变量名,只能是字母.数字及下划线 "_" 任意组成,而且不能以数字开头.在命名变量时,尽量避免与系统关键词重名,如:'an ...
- vue源码分析之new Vue过程
实例化构造函数 从这里可以看出new Vue实际上是使vue构造函数实例化,然后调用_init方法 _init方法,该方法在 src/core/instance/init.js 中定义 Vue.pro ...
- sublime 配置过程
https://www.cnblogs.com/chengqi521/p/7600379.html
- Web Application Vulnerablities
1. File inclusion berfoe start this caption i make a conclusion for install third-part as follow I ...
- day18正则及re模块
在线测试工具 http://tool.chinaz.com/regex/ 正则表达式本身和python语言没什么联系,只是匹配字符串内容的一种规则:详见:http://www.cnblogs.com/ ...
- 微信开发getLocation、openLocation等一些功能不起作用,但是走ready方法 closeWindow一些方法可以用
1.检查wx.config,发现我在jsApiList也声明了这些方法,并且也走了ready回调 wx.config({ debug: false, // 开启调试模式,调用的所有api的返回值会在客 ...
- 开启Golang编程第一章
Go is an open source programming language that makes it easy to build simple,reliable, and effcient ...