def __init__(self, enable): self.enable = enable if self.enable: self.window = tk.Toplevel() self.window.geometry("1800x900") self.window.title("GUI Output") self.canvas = Canvas(self.window, width=1800, height=900)
def createNewUI(self, taskName, taskInfo): detailWin = mtk.Toplevel(self.root) detailWin.title(taskName) detailWin.geometry("650x550") tasksInfoBox = mtk.LabelFrame(detailWin, text="任务说明:", fg="blue") tasksInfoBox.place(x=20, y=20, width=610, height=510) tasksIntro = scrolledtext.ScrolledText(tasksInfoBox, fg="green") tasksIntro.place(x=20, y=10, width=580, height=60) tasksIntro.insert( END, f"{''.join([taskInfo.get('EarnDeatile').get('detail')[j] for j in range(len(taskInfo.get('EarnDeatile').get('detail'))) if ord(taskInfo.get('EarnDeatile').get('detail')[j]) in range(65536)])}\n{taskInfo.get('EarnDeatile').get('condition')}" .replace(" ", "")) taskStep = mtk.LabelFrame(tasksInfoBox, text="任务步骤", fg="blue") taskStep.place(x=20, y=80, width=200, height=380) stepText = scrolledtext.ScrolledText(taskStep, fg="green") stepText.place(x=10, y=10, width=180, height=330) if isinstance(taskInfo.get("WjMissionDeatile"), list): totalTextList = [] for index, item in enumerate(taskInfo.get("WjMissionDeatile")): detail = item.get("detail", "") othLink = item.get("btnname", "") detailText = detail + othLink text = f"\n\nstep {index + 1}: " + ''.join([ detailText[j] for j in range(len(detailText)) if ord(detailText[j]) in range(65536) ]).strip() totalTextList.append(text) stepText.insert(END, "\n\n".join(totalTextList)) else: stepText.insert( END, f"\n\nstep 1: {taskInfo.get('WjMissionDeatile').get('msg')}") self.imageShow = mtk.LabelFrame(tasksInfoBox, text="图例", fg="blue") self.imageShow.place(x=240, y=80, width=350, height=380) taskId = taskInfo.get('EarnDeatile').get('id') imageList = self.imageInfo.get(taskId) IMG = [] if imageList: for image in imageList: if image[0]: self.pil_image = Image.open(image[0]) self.pil_image = self.pil_image.resize((320, 350), Image.ANTIALIAS) IMG.append(self.pil_image) self.image = mtk.Label(self.imageShow) if IMG: self.counter = 0 self.imgNow = ImageTk.PhotoImage(IMG[self.counter]) self.image.configure(image=self.imgNow) self.image.place(x=2, y=2, width=322, height=352) self.image.bind( sequence="<MouseWheel>", func=lambda x: self.thread_it(self.changeImage, IMG)) self.image.bind(sequence="<Button-3>", func=lambda x: self.thread_it(self.saveImage, IMG)) else: self.image.configure(text="暂无图片", fg="red")
def createNewUI(self, phoneNo): detailWin = mtk.Toplevel(self.root) detailWin.title(phoneNo) detailWin.geometry("300x400") errorInfoBox = mtk.LabelFrame(detailWin, text="ERROR信息:", fg="blue") errorInfoBox.place(x=20, y=20, width=250, height=350) errerText = mtk.Text(errorInfoBox) errerText.place(x=10, y=20, width=220, height=300) errerText.insert( mtk.END, "\n" + ''.join([ self.errordata[phoneNo][j] for j in range(len(self.errordata[phoneNo])) if ord(self.errordata[phoneNo][j]) in range(65536) ]).strip())
def openWindow(self, window, blocking=False, icon=None): ### setup window newContext = mtk.Toplevel(self.root) newContext.deiconify() ### set new context for window window.setContext(newContext, icon) ### add new window to our list self.windows.append(window) ### check window type ### blocking windows trigger all windows before them to f**k off :) if blocking == True: window.block() self.blockingWindows.append(window) ### open the window and let it render its views window.open()
def __init__(self, model, tkroot): self.dobleroot = tkroot #self.dobleroot.withdraw() #self.dobleroot.hide() self.root = tk.Toplevel(self.dobleroot) self.model = model self.botones = ['direccion', 'puerto', 'conectar'] self.error = tk.StringVar() self.inicializarFrames() self.inicializarBotones() self.cargarImagen() self.configurarEventos() self.cargarBotones() self.textlDireccionIP.focus() return
def deviceinfo(): """ Gets the device info from the current selected device :return: Creates a new window for the device info """ serial = devices[current_device].serial global server conn = httplib.HTTPConnection(server.strip() + ":80") conn.request("GET", "/device_info/" + serial) r1 = conn.getresponse() data = r1.read() data = data[1:-1] toplevel = tk.Toplevel() label1 = tk.Label(toplevel, text="Device info for serial: " + serial, height=0, width=100) label1.pack() label2 = tk.Label(toplevel, text=data, height=0, width=100) label2.pack()
def __init__(self): self.window = tk.Toplevel() self.window.geometry("1800x900") self.window.title("Human Brain") self.pixel_virtual = tk.PhotoImage(width=1, height=1) self.chosen_card, self.chose = None, False