- 博客(82)
- 收藏
- 关注
原创 10.1.2getWeather
import requestsimport sysfrom checkCityWeather import *from PyQt5.QtCore import *from PyQt5.QtWidgets import *from PyQt5.QtGui import *#原书api已失效rootPath = "http://t.weather.sojson.com/api/wea...
2019-03-28 11:12:00
365
原创 0925DataGrid
import sysfrom PyQt5.QtGui import *from PyQt5.QtWidgets import *from PyQt5.QtCore import *from PyQt5.QtSql import *import redef createDataBase(): db = QSqlDatabase.addDatabase('QSQLITE') ...
2019-03-27 11:44:59
221
原创 0924QSqlTableModel
import sysfrom PyQt5.QtSql import *from PyQt5.QtWidgets import *from PyQt5.QtGui import *from PyQt5.QtCore import *class demoWin(QDialog): def __init__(self): super(demoWin, self)....
2019-03-26 11:16:27
253
原创 7.3.5 QT Designer:界面显示与业务逻辑的分离
业务代码import sysfrom PyQt5.QtWidgets import *from PyQt5.QtCore import *from PyQt5.QtGui import *from MainWinSignalSlog02 import Ui_MainWinSignalSlog02class MyMainWindow(QMainWindow, Ui_Mai...
2019-03-15 15:47:57
2713
原创 0509A-processEvents
import sysfrom PyQt5.QtGui import *from PyQt5.QtCore import *from PyQt5.QtWidgets import *import timeclass demoProcessEvents(QWidget): def __init__(self): super(demoProcessEvents, ...
2019-03-14 11:01:01
188
原创 0509QThread
#这个例子的变量不用传递,直接被函数调用?import sysfrom PyQt5.QtWidgets import *from PyQt5.QtCore import *from PyQt5.QtGui import *global secsec = 0class myThread(QThread): trigger = pyqtSignal() def ...
2019-03-14 10:34:17
100
原创 0508QScrollBar
import sysfrom PyQt5.QtWidgets import *from PyQt5.QtCore import *from PyQt5.QtGui import *class demoQScrollBar(QWidget): def __init__(self): super(demoQScrollBar, self).__init__() ...
2019-03-13 15:56:04
169
原创 0507QMultipleDoc
import sysfrom PyQt5.QtWidgets import *from PyQt5.QtCore import *from PyQt5.QtGui import *class demoQMultipleDoc(QMainWindow): count = 0 def __init__(self): super(demoQMultipleDo...
2019-03-13 15:40:49
97
原创 0505QDockWidget
import sysfrom PyQt5.QtCore import *from PyQt5.QtGui import *from PyQt5.QtWidgets import *class demoQDockWidget(QMainWindow): def __init__(self): super(demoQDockWidget, self).__init_...
2019-03-13 15:09:03
108
原创 0505QStackedWidget
import sysfrom PyQt5.QtWidgets import *from PyQt5.QtGui import *from PyQt5.QtCore import *#父级又是QWidget,不清楚什么时候是QWidget什么时候是其它class demoStackedWidget(QWidget): def __init__(self): su...
2019-03-13 11:31:55
96
原创 0504QTabWidget
import sysfrom PyQt5.QtCore import *from PyQt5.QtGui import *from PyQt5.QtWidgets import *#注意父级是QTabWidgetclass demoQTabWidget(QTabWidget): def __init__(self): super(demoQTabWidget,...
2019-03-13 10:19:38
133
原创 0502QTableWidget
import sysfrom PyQt5.QtGui import *from PyQt5.QtWidgets import *from PyQt5.QtCore import *class demoTable(QWidget): def __init__(self): super(demoTable, self).__init__() self...
2019-03-12 15:46:17
105
原创 0436QStatusBar
#这里加不加[QAction]效果都一样,那加了是什么用意?#file.triggered[QAction].connect(self.clickAction)file.triggered.connect(self.clickAction)import sysfrom PyQt5.QtGui import *from PyQt5.QtCore import *from Py...
2019-03-08 11:11:43
93
原创 0434QMenuBar
import sysfrom PyQt5.QtWidgets import *from PyQt5.QtCore import *from PyQt5.QtGui import *class demoQMenuBar(QMainWindow): def __init__(self): super(demoQMenuBar, self).__init__() ...
2019-03-07 16:56:08
138
原创 0433QDateTimeEdit1
import sysfrom PyQt5.QtGui import *from PyQt5.QtCore import *from PyQt5.QtWidgets import *class demoQDateTimeEdit1(QWidget): def __init__(self): super(demoQDateTimeEdit1, self).__ini...
2019-03-07 16:11:18
114
原创 432QCalendar
import sysfrom PyQt5.QtWidgets import *from PyQt5.QtCore import *from PyQt5.QtGui import *class demoQClalendar(QWidget): def __init__(self): super(demoQClalendar, self).__init__() ...
2019-03-07 15:48:34
132
原创 0431QClipboard
import osimport sysfrom PyQt5.QtGui import *from PyQt5.QtWidgets import *from PyQt5.QtCore import *class demoQClipboard(QDialog): def __init__(self): super(demoQClipboard, self).__i...
2019-03-07 11:42:55
115
翻译 python的Mutagen的类的概况
原文:https://mutagen.readthedocs.io/en/latest/user/classes.htmlClass OverviewThe main notable classes in mutagen are FileType, StreamInfo, Tags, Metadata and for error handling the MutagenError exc...
2018-12-11 15:47:23
439
翻译 python的Mutagen模块入门
原文:https://mutagen.readthedocs.io/en/latest/user/gettingstarted.htmlThe File functions takes any audio file, guesses its type and returns a FileType instance or None. File函数可以输入任意音频文件,然后分析其可能的类型...
2018-12-11 09:57:31
4648
1
翻译 python的Mutagen模块简介
准备打算做一个项目,可能用到这个模块,就先照搬官网,做个翻译官网地址:https://mutagen.readthedocs.io/en/latest/Mutagen is a Python module to handle audio metadata. It supports ASF, FLAC, MP4, Monkey’s Audio, MP3, Musepack, Ogg Opu...
2018-12-11 09:48:19
8326
原创 有道爬虫翻译
import urllib.requestimport urllib.parseimport jsonimport timeimport randomimport hashliburl = "http://fanyi.youdao.com/translate_o?smartresult=dict&smartresult=rule"while True: ...
2018-05-04 14:52:47
641
原创 不要二——python的二维数组
python中的二维数组可以写成:myList = [([1]*x)for i in range(y)]链接:https://www.nowcoder.com/questionTerminal/1183548cd48446b38da501e58d5944eb来源:牛客网二货小易有一个W*H的网格盒子,网格的行编号为0~H-1,网格的列编号为0~W-1。每个格子至多可以放一块蛋糕,任意两块蛋糕的欧几...
2018-04-28 17:03:53
216
原创 stdin为什么不可迭代?
题目描述牛牛想尝试一些新的料理,每个料理需要一些不同的材料,问完成所有的料理需要准备多少种不同的材料。输入描述:每个输入包含 1 个测试用例。每个测试用例的第 i 行,表示完成第 i 件料理需要哪些材料,各个材料用空格隔开,输入只包含大写英文字母和空格,输入文件不超过 50 行,每一行不超过 50 个字符。输出描述:输出一行一个数字表示完成所有料理需要多少种不同的材料。示例1输入BUTTER FL...
2018-04-28 11:15:03
324
原创 【待解决】应该是指针出错,但找不到具体错在哪里
这期题目不重要,用python一下子就过了,但c里面却出现了一个我想不透的问题。我觉得我已经解决了,其实不是指针问题,是处理完字符了忘了加'\0'导致溢出,但是我即使这样改了,自己编译器通过了,但牛客网上仍提示我案例“657 37”错了。。。我真是无语#include <stdio.h>#include <stdlib.h>#include <string.h&g...
2018-04-28 09:53:37
257
2
原创 幸运数
题目描述小明同学学习了不同的进制之后,拿起了一些数字做起了游戏。小明同学知道,在日常生活中我们最常用的是十进制数,而在计算机中,二进制数也很常用。现在对于一个数字x,小明同学定义出了两个函数f(x)和g(x)。 f(x)表示把x这个数用十进制写出后各个数位上的数字之和。如f(123)=1+2+3=6。 g(x)表示把x这个数用二进制写出后各个数位上的数字之和。如123的二进制表示为1111011,...
2018-04-25 16:31:32
423
原创 Fibonacci数列
Fibonacci数列是这样定义的:F[0] = 0F[1] = 1for each i ≥ 2: F[i] = F[i-1] + F[i-2]因此,Fibonacci数列就形如:0, 1, 1, 2, 3, 5, 8, 13, ...,在Fibonacci数列中的数我们称为Fibonacci数。给你一个N,你想让其变为一个Fibonacci数,每一步你可以把当前数字X变为X-1或者X+1,现在给...
2018-04-25 15:55:57
221
原创 网格走法数目
链接:https://www.nowcoder.com/questionTerminal/e27b9fc9c0ec4a17a5064fb6f5ab13e4来源:牛客网有一个X*Y的网格,小团要在此网格上从左上角到右下角,只能走格点且只能向右或向下走。请设计一个算法,计算小团有多少种走法。给定两个正整数int x,int y,请返回小团的走法数目。 输入描述:输入包括一行,逗号隔开的两个正整数x和y...
2018-04-25 14:58:35
373
原创 a, b = [1, 2]
python真的神奇,直接a, b = [1, 2]这样就可以取出列表中的元素。。服>>> a, b = [1, 2]>>> a1>>> b2>>>
2018-04-25 11:33:47
1606
1
原创 统计回文
妈耶。我差不多20天没更新过了,怎么办,学python一直意外地慢,没有配套的编程练习学了又忘记了。学编程还得靠编程练习。。。。。。。。。。。。所以我去刷做牛客网的题。题目描述“回文串”是一个正读和反读都一样的字符串,比如“level”或者“noon”等等就是回文串。花花非常喜欢这种拥有对称美的回文串,生日的时候她得到两个礼物分别是字符串A和字符串B。现在她非常好奇有没有办法将字符串B插入字符串A...
2018-04-24 22:41:21
121
转载 python chr()和ord()
Python ord() 函数 Python 内置函数描述ord() 函数是 chr() 函数(对于8位的ASCII字符串)或 unichr() 函数(对于Unicode对象)的配对函数,它以一个字符(长度为1的字符串)作为参数,返回对应的 ASCII 数值,或者 Unicode 数值,如果所给的 Unicode 字符超出了你的 Python 定义范围,则会引发一个 TypeError 的异常。语...
2018-04-09 15:43:33
631
原创 输出字典key
最近都在学python,但是总不得要领,学得十分缓慢,想靠做题提高熟悉度,但是奈何总跟不上答案的节奏。唯一把题目记下来,写一下blog,一个个弄懂。给你一字典a,如a={1:1,2:2,3:3},输出字典a的key,以','连接,如‘1,2,3'。要求key按照字典序升序排列(注意key可能是字符串)。例如:a={1:1,2:2,3:3}, 则输出:1,2,3答案print(",".join(...
2018-04-08 15:05:39
2967
原创 1033. To Fill or Not to Fill (25)
居然用例2的起点压根没有加油站。。。。MMPWith highways available, driving a car from Hangzhou to any other city is easy. But since the tank capacity of a car is limited, we have to find gas stations on the way from time...
2018-04-02 23:24:03
132
原创 1031. Hello World for U (20)
又遇到一题水题,又产生了一种我很强的错觉了,话说csdn的表情怎么还是00年代风。。。。这题唯一难点不在编程,在于弄清楚n1,n2,n3是怎么算出来的Given any string of N (>=5) characters, you are asked to form the characters into the shape of U. For example, "helloworld...
2018-03-29 15:37:55
97
原创 1030. Travel Plan (30)
1030. Travel Plan (30)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueA traveler's map gives the distances between cities along the highways, together with the cost of each highwa...
2018-03-28 21:14:32
138
原创 1029. Median (25)
一连几题都不觉得难,让我产生了一种我也很强的错觉。。。。。这题就是简单的排序,自从学会用qsort之后觉得排序问题都弱爆了。一开始没有留意到题目给出的两个数组已经有序的,我就将两个数组合成一个,然后直接qsort。这时犯了一个逗比的错误,我知道两个1000000会超过数组最大长度,不能直接a[1000000]定义,会出现段错误。要用malloc申请空间,逗比的我只对sque这样做了,Q1和Q2继续...
2018-03-27 14:17:47
269
原创 1028. List Sorting (25)
1028. List Sorting (25)时间限制200 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueExcel can sort records according to any column. Now you are supposed to imitate this function.InputEach...
2018-03-26 17:28:58
90
原创 1027. Colors in Mars (20)
1027. Colors in Mars (20)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YuePeople in Mars represent the colors in their computers in a similar way as the Earth people. That is, a c...
2018-03-26 17:19:57
103
原创 PAT的考后感
终于考完了PAT,成绩在意料之中吧。总结一下失败经验吧。 一、毕竟准备得并不充分,或者叫实力不足,这是首要原因,下面的都是次要原因。以后打算还是一天一条PAT,一天一章python学习。 二、对IDE不熟悉,考场有code block,但打开提示找不到编译器路径,然后就不知道怎么处理了,最后还是放弃,只能用visual studio。哎,真心用不惯这货。 ...
2018-03-20 19:15:32
8805
1
原创 1016. Phone Bills (25)
A long-distance telephone company charges its customers by the following rules:Making a long-distance call costs a certain amount per minute, depending on the time of day when the call is made. When...
2018-03-12 22:23:53
134
原创 1014. Waiting in Line (30)
喵的,看到各位大神说,这题很简单呀,用队列模拟就好。。。。可是我想了很久呀。。。还有已接的业务可以做到17:59这个大坑呀。Suppose a bank has N windows open for service. There is a yellow line in front of the windows which devides the waiting area into two part...
2018-03-11 14:00:17
166
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人