def onLeftButtonUp(event): self.sel = False deleteLastDraw() Common.sleep(0.1) # 考虑鼠标左键从右下方按下而从左上方抬起的截图 left, right = sorted([self.X.get(), event.x]) top, bottom = sorted([self.Y.get(), event.y]) pic = ImageGrab.grab((left+1, top+1, right, bottom)) save_name = "ScreenShot-{0}.png".format(Common.get_time(format=False)) pic.save(save_name) self.top.destroy() Common.remove(self.temp_png) WidgetTip.info("截图成功: {0}\n截图保存在工具家目录下".format(save_name))
def insert_text_info(self, data): info, level = data color = Global.G_INFOWIN_LEVEL_COLOR[level.upper()] info = "[{0}] {1}: {2}".format(level.upper(), Common.get_time(), info) self.info_inst.insert_text(info, color)