批量下载国家地理壁纸Python脚本(wxpython版)

简介:
[今天在CU的python版里看到一篇"批量下载国家地理壁纸Python脚本"。感觉不错,借此,用wxpython写了一个GUI的界面。]



部分代码
import wx
from getimg import getimg

class GetImgFrame(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None, -1, 'GetImages',size=(500,150))
        panel = wx.Panel(self, -1)
        wx.StaticText(panel, -1, "Please enter a downloadable conditional",pos=(10,5))
        self.basicLabel = wx.StaticText(panel, -1, "Year:",pos=(30,40))
        self.yearText = wx.TextCtrl(panel, -1, "2009",pos=(60,40))
        self.yearText.SetInsertionPoint(0)
        self.basicLabel = wx.StaticText(panel, -1, "Month:",pos=(180,40))
        self.monthText = wx.TextCtrl(panel, -1, "7",pos=(220,40))
        self.monthText.SetInsertionPoint(0)
        self.basicLabel = wx.StaticText(panel, -1, "Day:",pos=(350,40))
        self.dayText = wx.TextCtrl(panel, -1, "1",pos=(380,40))
        self.dayText.SetInsertionPoint(0)
        self.button = wx.Button(panel, -1, "Download", pos=(380,80))              
        self.Bind(wx.EVT_BUTTON,self.OnDownload,self.button)
        self.Bind(wx.EVT_CLOSE,self.OnCloseWindow)
        
    def OnDownload(self,evt):
        year=int(self.yearText.GetValue())
        month=int(self.monthText.GetValue())
        day=int(self.dayText.GetValue())
        self.button.Enable(False)
        for day in range(1, day+1):
            getimg(year, "%(#)02d"%{"#":month}, "%(#)02d"%{"#":day}, "0", "http://192.168.1.114:666/",self.button)
        
    def OnCloseWindow(self,evt):
        self.Destroy()

if __name__ == '__main__':
    app = wx.PySimpleApp()
    GetImgFrame().Show()

    app.MainLoop() 



本文转自hahazhu0634 51CTO博客,原文链接:http://blog.51cto.com/5ydycm/275289,如需转载请自行联系原作者

相关文章
|
20天前
|
Linux Shell Python
Linux执行Python脚本
Linux执行Python脚本
26 1
|
2月前
|
Web App开发 数据采集 自然语言处理
python脚本抢各大平台大额优惠卷
python脚本抢各大平台大额优惠卷
48 0
|
9天前
|
JSON 测试技术 持续交付
自动化测试与脚本编写:Python实践指南
【4月更文挑战第9天】本文探讨了Python在自动化测试中的应用,强调其作为热门选择的原因。Python拥有丰富的测试框架(如unittest、pytest、nose)以支持自动化测试,简化测试用例的编写与维护。示例展示了使用unittest进行单元测试的基本步骤。此外,Python还适用于集成测试、系统测试等,提供模拟外部系统行为的工具。在脚本编写实践中,Python的灵活语法和强大库(如os、shutil、sqlite3、json)助力执行复杂测试任务。同时,Python支持并发、分布式执行及与Jenkins、Travis CI等持续集成工具的集成,提升测试效率和质量。
|
13天前
|
Linux API 开发者
python2安装wxpython模块源
【4月更文挑战第4天】
33 11
|
16天前
|
存储 监控 异构计算
【Python】GPU内存监控脚本
【Python】GPU内存监控脚本
|
16天前
|
Ubuntu Unix Linux
【Linux/Ubuntu】Linux/Ubuntu运行python脚本
【Linux/Ubuntu】Linux/Ubuntu运行python脚本
|
24天前
|
XML Shell Linux
性能工具之 JMeter 使用 Python 脚本快速执行
性能工具之 JMeter 使用 Python 脚本快速执行
40 1
性能工具之 JMeter 使用 Python 脚本快速执行
|
1月前
|
数据采集 测试技术 Python
Python自动化脚本的魅力与实践
Python自动化脚本的魅力与实践
48 0
|
1月前
|
数据安全/隐私保护 Python
使用Python脚本实现图片合成PDF功能
使用Python脚本实现图片合成PDF功能
26 0
|
1月前
|
安全 数据安全/隐私保护 开发者
如何使用Pyarmor保护你的Python脚本
如何使用Pyarmor保护你的Python脚本
42 0

热门文章

最新文章