国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 編程 > Python > 正文

獲取內(nèi)涵段子的python 和 顯示圖片

2019-11-06 06:02:01
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

# -*- coding: utf-8 -*-import urllib2,os,cookielibimport systype = sys.getfilesystemencoding()i=0cookie=cookielib.CookieJar()opner=urllib2.build_opener(urllib2.HTTPCookiePRocessor(cookie))while 1==1:  response=opner.open(urllib2.Request('http://neihanshequ.com/'))  html = response.read()  while html.find("data-text=/"")!=-1:    html=html[html.find("data-text=/"")+len("data-text=/""):]    text=html[0:html.find("/"")]    joke=str(i)+'.'+text+'/n'    i+=1    print joke.decode('utf-8').encode(type)    os.system("pause")  html=''  i=0

import wx

class  Frame(wx.Frame):    max_width = 400    max_height = 600    def __init__(self,app):        wx.Frame.__init__(self,None,-1,"ShowPic",size=(400,600))        self.bmoved=False        self.app=app        self.bmp = wx.StaticBitmap(self, 0, wx.NullBitmap, (0,0), (400,400))        self.Hide()        def ShowImage(self,path):        image=wx.Image(path,wx.BITMAP_TYPE_ANY)        bmp=image.ConvertToBitmap()        size=self.GetSize(bmp)        print size        self.SetSize(size)        bmp=image.Scale(size[0], size[1]).ConvertToBitmap()        self.bmp.SetSize(size)        self.bmp.SetBitmap(bmp)        self.Show()    def GetSize(self, bmp):        width = bmp.GetWidth()        height = bmp.GetHeight()        if width>self.max_width:            height = height*self.max_width/width            width = self.max_width        if height>self.max_height:            width = width*self.max_height/height            height = self.max_height        size = width, height        return size        class APP(wx.App):    def __init__(self, redirect=False):        wx.App.__init__(self, redirect)    def OnInit(self):        self.frame=Frame(self)        self.ShowImage()        self.frame.Show()        return True    def ShowImage(self):        self.frame.ShowImage("C://Users//Administrator//Desktop//1.jpg")    def Close(self):        self.frame.Close()def main():    app=APP()    app.MainLoop()if __name__ == '__main__':    main()
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 石林| 广灵县| 湖北省| 吉安市| 新泰市| 昌乐县| 阳谷县| 镇平县| 洪湖市| 二连浩特市| 奈曼旗| 麻江县| 图们市| 三原县| 高淳县| 裕民县| 黎平县| 苍山县| 阳春市| 奉贤区| 东港市| 涞水县| 三原县| 纳雍县| 清水县| 陵水| 永济市| 晋宁县| 天全县| 顺义区| 福鼎市| 嵩明县| 隆尧县| 南川市| 禄丰县| 双城市| 山西省| 中卫市| 连城县| 滨海县| 渑池县|