Files
Hacking-with-Python/03/grabber.py

21 lines
415 B
Python
Raw Normal View History

2020-11-12 17:02:10 +08:00
import wx
import os
import ftplib
w = wx.App()
screen = wx.ScreenDC()
size = screen.GetSize()
bmap = wx.Bitmap(size[0],size[1])
memo = wx.MemoryDC(bmap)
memo.Blit(0,0,size[0],size[1],screen,0,0)
bmap.SaveFile("grabbed.png", wx.BITMAP_TYPE_PNG)
2020-12-03 21:58:27 +08:00
sess_ = ftplib.FTP("localhost","flypython", "flypython")
2020-11-12 17:02:10 +08:00
file_ = open("grabbed.png", "rb")
2020-12-03 21:58:27 +08:00
sess_.storbinary("STOR grabbed.png", file_)
2020-11-12 17:02:10 +08:00
file_.close()
sess_.quit()