Python 定时自动发布微博

注:weibo这个第三方库目前只支持python2.7 3.3 3.4 三个版本 API_KEY 需要再微博api接口那里申请,审核没通过的应用会显示“未通过审核应用” 下面的代码是在python2.7的版本上编写的 # encoding: utf-8 from weibo import Client import schedule,time # API_KEY = ” # API_SECRET = ” # REDIRECT_URI = ‘http://www.henhaoji.net’ # client = Client(API_KEY, API_SECRET, REDIRECT_URI, username=”, password=”) # client.post(‘statuses/share’,status=u’你好微博’ + ‘http://www.henhaoji.net…

Read More

Pyqt5 下载B站视频小软件

import os,re,time,datetime,sys,random,math,webbrowser,menub,threading,json from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5 import QtWidgets,QtGui,QtCore from PyQt5.QtCore import * from Ui_video import Ui_MainWindow from functools import partial import requests from bs4 import BeautifulSoup from you_get import common as you_get #导入数据库 from PyQt5 import QtSql from PyQt5.QtSql impo…

Read More

QObject::setParent: Cannot set parent, new parent is in a different thread Pyqt5多线程操作出现的错误解决办法

该应用程序试图从不同的线程更新窗口进度条的值(QThreadPool())。当它试图更新进度条时,python给出如下警告: QObject::setParent: Cannot set parent, new parent is in a different thread 这在一定程度上不会影响应用程序,但过了一会儿,应用程序崩溃,出现以下错误消息。 有问题的程序代码 import sys from PyQt5.QtCore import * from PyQt5 import QtCore, QtGui, QtWidgets import thread_for_audio_record import time class FW(object): def __init__(self): self.threadpool = QThreadPool() def f_w(self, windo…

Read More

Python多线程

import time, threading def threadFunction(): while True: print(11111) time.sleep() # 用于命名,可以通过threading.current_thread().name获得 t = threading.Thread(target=threadFunction, name=’funciton’) # 如果线程有参数 t = threading.Thread(target=threadFunction, args=(), name=’funciton’) t.start()   多线程的好处就是不同等到某个函数执行完再去执行别的函数

Python+pyqt5+designer 实现信息录入系统

主程序代码编写 import os,time,datetime,sys,random,math from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5 import QtWidgets,QtGui from PyQt5.QtCore import * from Ui_info5 import Ui_MainWindow from functools import partial #导入数据库 from PyQt5 import QtSql from PyQt5.QtSql import QSqlQuery class Mywindow(Ui_MainWindow,QMainWindow): def __init__(self): super().__init__() self.setupUi(self) self…

Read More

windows64 位系统下如何使用pyinstaller打包32位的exe–Python知识点

说明:原来安装的python为64位,故安装的pyinstaller和打包后的exe都为64位。而64位的exe文件在32位的win7操作系统下是无法执行的,显示不兼容。网上查询发现,简单(可能不方便)的方法是采用32位的python重新打包。这里,我使用的是conda构建32位python环境,然后再次打包。 注:一开始安装python3.7的版本,打包出现错误 改成python3.6一切正常! 构建32位python环境 进入命令提示符窗口 set CONDA_FORCE_32BIT=1 //切换到32位 =0则切换到64位 conda create –name python36 python=3.6 //创建一个python3.6的环境,命名为python36 conda info –envs //查看是否添加成功 activate python36 //切换到python3.6…

Read More