示例#1
0
    def print_classes(self):
        frm = Frame(self)
        frm.grid(column=2, row=1, rowspan=20, sticky=(N, E, W, S))

        rowOffset = 0
        label = Label(self, text="Grain Classes:")
        label.grid(row=rowOffset, column=2)
        for k in sorted(self.classesDict.keys()):
            rowOffset += 1
            classDescr = "" + k + ":"
            for grain in self.classesDict[k]:
                classDescr = classDescr + "\n" + grain
            classMsg = Message(frm, text=classDescr)  #, width=100)
            classMsg.grid(column=0, row=rowOffset, sticky=(N, W))

        #print("GRAIN_COLS:")
        #print(GRAIN_COLS)
        self.window.calc.cclasses_changed(self.classesDict)

        if len(self.remaining_grains) == 0:
            #self.b_accept.config(state = NORMAL)
            self.b_remaining.config(state=DISABLED)
            self.b_add.config(state=DISABLED)
        else:
            self.b_add.config(state=NORMAL)
            self.b_remaining.config(state=NORMAL)
            #self.b_accept.config(state = DISABLED)

        if len(self.classesDict) == 0:
            self.b_reset.config(state=DISABLED)
        else:
            self.b_reset.config(state=NORMAL)
示例#2
0
    def __init__(self):
        ''' Iniciador da classe
        '''
        super(Window, self).__init__()
        self.title('Conversor do PAD')
        # self.geometry('{width}x{height}'.format(width=800, height=400))

        # Texto introdutório
        text_intro = '''
Conversor do PAD é um conversor de layout que converte os dados gerados pelos sistemas informatizados com a finalidade de serem importados pelo SIAPC/PAD do TCE/RS.

Basicamente, o programa pega os dados e os converte para um formato diferente.
        '''
        self.intro = Message(self,
                             text=text_intro,
                             justify=LEFT,
                             anchor=N + W,
                             padx=10,
                             pady=10,
                             width=700)
        self.intro.pack(fill=X)

        # Formulário com os campos de configuração
        form = Frame(self, padx=10, pady=10)
        form.pack()

        self._build_source_field(form)  # Seletor do diretório de origem
        self._build_output_field(form)  # Seletor do diretório de destino
        self._build_output_format(form)  # Seleção de formatos de saída
        self._build_output_name(form)  # Nome do arquivo de saída
        self._build_progress_bar(form)  # Barra de progresso
        self._build_start_button(form)  # Botão de conversão
        self._build_info_box(form)  # Caixa de informações
        self._build_status_bar()  # Barra de status
示例#3
0
    def addRealmRow(self, realm):
        if not realm:
            return

        index = len(self.savedRealmName)
        name = realm['name']
        address = realm['address']

        self.savedRealmName.append(
            Message(self.savedRealmsFrame, text=name, width=250))
        self.savedRealmName[index].grid(column=0, row=index + 1)

        self.savedRealmAddress.append(
            Message(self.savedRealmsFrame, text=address, width=250))
        self.savedRealmAddress[index].grid(column=1, row=index + 1)

        self.selectRealmButton.append(
            Button(self.savedRealmsFrame,
                   text='SET',
                   command=lambda rlm=realm: self.setActiveRealm(rlm)))
        self.selectRealmButton[index].grid(column=2, row=index + 1)

        self.removeRealmButton.append(
            Button(self.savedRealmsFrame,
                   text='REMOVE',
                   command=lambda idx=index: self.removeSavedRealm(idx)))

        self.removeRealmButton[index].grid(column=3, row=index + 1)
        self.totalRealmItems = index + 1
示例#4
0
 def __init__(self,
              master,
              text='',
              buttons=[],
              default=None,
              cancel=None,
              title=None,
              class_=None):
     if class_:
         self.root = Toplevel(master, class_=class_)
     else:
         self.root = Toplevel(master)
     if title:
         self.root.title(title)
         self.root.iconname(title)
     self.message = Message(self.root, text=text, aspect=400)
     self.message.pack(expand=1, fill=BOTH)
     self.frame = Frame(self.root)
     self.frame.pack()
     self.num = default
     self.cancel = cancel
     self.default = default
     self.root.bind('<Return>', self.return_event)
     self.root.bind('<Escape>', self.wm_delete_window)
     for num in range(len(buttons)):
         s = buttons[num]
         f = Frame(self.frame)
         b = ttk.Button(f,
                        text=s,
                        command=(lambda self=self, num=num: self.done(num)))
         b.pack(side=LEFT, fill=BOTH)
         f.pack(side=TOP, fill=BOTH)
     self.root.protocol('WM_DELETE_WINDOW', self.wm_delete_window)
     self._set_transient(master)
 def make_Message_3(self, frame):
     self.Message_3 = Message(
         frame,
         width="400",
         text="Use numbered \"Quick-Set\" buttons or set Spinbox and hit OK."
     )
     self.Message_3.grid(row=2, column=0, columnspan="6")
示例#6
0
 def __init__(self, wdw, sols):
     """
     Stores the list of solutions in sols
     and defines the layout of the GUI.
     """
     wdw.title('solutions scroller')
     self.sols = sols
     self.cursor = 0
     self.lbl = Label(wdw, text="solution : ")
     self.lbl.grid(row=0, column=0, sticky=E)
     self.ent = Entry(wdw)
     self.ent.grid(row=0, column=1, stick=W)
     self.ent.insert(INSERT, "0 of %d" % len(sols))
     self.myft = Font(family="Courier New", size=12, weight="normal")
     self.mlen = self.myft.measure("M")
     lines = sols[0].split('\n')
     self.width = max([len(line) for line in lines])
     self.display = StringVar()
     self.display.set(self.sols[0])
     self.mess = Message(wdw, textvariable=self.display, \
         font=self.myft, width=self.width*self.mlen, background='white')
     self.mess.grid(row=1, column=0, columnspan=2)
     self.btnext = Button(wdw, command=self.next, text='next')
     self.btnext.grid(row=2, column=1, sticky=W + E)
     self.btprev = Button(wdw, command=self.previous, text='previous')
     self.btprev.grid(row=2, column=0, sticky=W + E)
 def make_Message_1(self, frame):
     self.Message_1 = Message(
         frame,
         text=
         "Weight affects how widgets expand and contract on window resize.",
         width="400")
     self.Message_1.grid(row=6, column=0, columnspan="6")
示例#8
0
    def main(self):
        """
        Method name: main.

        Method use: The program starts the main GUI of the Rating System.
        """
        try:
            self.IS.destroy()
        except:
            pass
        try:
            self.EM.destroy()
        except:
            pass
        self.MF = Frame(self.master)
        self.MF.pack()
        WelcomeLabel = Label(self.MF,
                             text="Choose who you are ?",
                             font=("Arial", 20))
        WelcomeLabel.grid(column=1, columnspan=2)
        label = Label(self.MF, text=" ")
        label.grid(row=2, columnspan=2)
        ISButton = Button(self.MF, text="Intern", command=self.internWindow)
        ISButton.grid(row=3, column=1)
        EMButton = Button(self.MF,
                          text="Employee",
                          command=self.employeeWindow)
        EMButton.grid(row=3, column=2)
        contentText = "\n\nWhat is this?\nThis app lets us to rate Interns through the FLO blockchain .\n\nThis is a zero knowledge application.\n\nHow to work ?\n\n Choose if you are an Intern or Employeer\n\n" + "An Intern's work would be to enter the Transaction id in the given field and get rating\n\nAn Empolyee must enter the transaction address and write all the intern data to it "
        Context = Message(self.MF, text=contentText)
        Context.grid(column=1, columnspan=2)
示例#9
0
 def pop_up(self, text):
     top = Toplevel()
     top.title("ERROR")
     msg = Message(top, text=text)
     msg.pack()
     button = Button(top, text="Dismiss", command=top.destroy)
     button.pack()
示例#10
0
def update_server(frame, server_key):
    show_server = Message(frame,
                          text=server_key,
                          aspect=2000,
                          anchor=W,
                          relief=SUNKEN)
    show_server.place(x=80, y=30, width=215, height=30)
示例#11
0
    def iniciar(self, master: object) -> None:
        if 'fz' in self.defs.mcnf:
            fonte = self.defs.cnf['font']
            self.defs.cnf['font'] = (fonte[0], self.defs.mcnf['fz'], fonte[2])

        Message.__init__(self, master=master, cnf=self.defs.cnf)
        self.mostrar()
示例#12
0
def codeCreateUrgency():

    # Interfaz para seleccionar el archivo Excel que contienen los datos necesarios para la creación del cambio
    root.filename = filedialog.askopenfilename(
        filetypes=[("Excel files", ".xlsx .xls .xlsm")])

    # Guarda los respectivos datos para la creación del CH
    dataCH = ReadDataInfo(root.filename)
    tasks, countRB = ReadDataSub(root.filename)

    # crear el cambio
    estadoCH, urlCH = CreationCHU(dataCH, tasks, countRB)

    # Devuelve el resultado de la ejecución del CH
    returnStatus.set(estadoCH)
    returnURL.set(urlCH)

    # Mensajes en la pantalla según el return de la funcion CreationCH
    resultStatus = Message(frame, textvariable=returnStatus, bg="#f8f8fb", fg="#c65185", font=(
        "Alata", 9), width=210, justify="center", cursor="center_ptr")
    resultStatus.place(x=108, y=150)

    resultURL = Entry(frame, textvariable=returnURL, bg="#f8f8fb",
                      fg="#3d3132", font=("Alata", 7), width=52, justify="center")
    resultURL.place(x=83, y=180)
示例#13
0
    def __init__(self, master):
        ''' Initializes the GUI. '''
        self.master = master
        self.bg = "#90EE90"
        self.fg = "#654321"
        self.e_page = "empty"
        master.title("Trail Blazer")
        master.geometry("1920x1080")
        master.configure(bg=self.bg)
        master.bind("<Escape>", self.close)

        self.start = Frame(master, height=1080, width=1920, bg=self.bg)
        self.start.pack()
        self.start.focus_set()
        self.start.bind("<Return>", self.login_page)
        self.greet = Label(self.start, text="Welcome to our Route Suggestion GUI!", font=("sans serif", 50),
                           fg=self.fg, bg=self.bg, pady=10)
        self.greet.pack()
        self.intro = Message(self.start, text="We are writing software to help generate and visualize new routes for runners, walkers, and bikers. \nWe are creating this for our Software Design final project.",
                             font=("sans serif", 20), width=1900, justify=CENTER, fg=self.fg, bg=self.bg, pady=10)
        self.intro.pack()


        self.buttons1 = Frame(self.start, width=500, bg=self.bg)
        self.buttons1.pack()
        self.proceed = Button(self.buttons1, text="Proceed", bg="#64e764", fg="#654321", pady=5,
                              activebackground="#bcf5bc", activeforeground="#8b5d2e", command=self.login_page)
        self.proceed.grid(row=0, column=0)
        self.cancel = Button(self.buttons1, text="Cancel", bg="#64e764", fg="#654321", pady=5,
                             activebackground="#bcf5bc", activeforeground="#8b5d2e", command=master.quit)
        self.cancel.grid(row=0, column=1)

        self.logo = PhotoImage(file="images/trail_blazer_logo.gif")
        self.logo_disp = Label(self.start, image=self.logo, fg=self.fg, bg=self.bg)
        self.logo_disp.pack(side=BOTTOM)
示例#14
0
def update(frame_number):
    fig.clear()
    global carry_on
    matplotlib.pyplot.xlim(0, maxEnv - 1)
    matplotlib.pyplot.ylim(0, maxEnv - 1)
    matplotlib.pyplot.imshow(environment)
    matplotlib.pyplot.title("Iteration:" + str(frame_number) + "/" +
                            str(num_of_iterations))
    for j in range(num_of_iterations):
        print(agents[0].x, agents[0].y)
        for i in range(num_of_agents):
            agents[i].move()
            #Agent eats values
            agents[i].eat()
            #print("Eating")
            if agents[i].store > 100:
                #Greedy agents are sick if they eat more than 100 units
                agents[i].sick()
                #print ("Being sick")
    for i in range(num_of_agents):
        # agent is half full
        if agents[i].store > 50:
            carry_on = False
        else:
            carry_on = True
        print(carry_on)
    if carry_on == False:
        w = Message(root, anchor="n", text="All sheep are at least half full")
        w.pack()
        print("All sheep are at least half full")
    for i in range(num_of_agents):
        matplotlib.pyplot.scatter(agents[i].x, agents[i].y)
示例#15
0
 def destroy():
     editbook.destroy()
     updatebook.destroy()
     master = Tk()
     w = Message(master, text="Records Have Been Updated!!!")
     w.pack()
     mainloop()
示例#16
0
    def run_top_level_windows(self):
        """
        Creates top level window which describes the application's function to the user.
        :return: None
        """
        self.root.withdraw()
        top = Toplevel()
        top.title("About image processing application.")
        message = Message(
            top,
            text=
            "This application is used to process image files.  Begin by hitting Open Image "
            "under Options on the title bar and entering the name of a file stored in the "
            "images folder.",
            width=300)
        message.pack()

        def button_hit():
            """
            Actions for when the continue button on the top level window is hit.
            :return: None
            """
            top.destroy()
            self.root.deiconify()
            w, h = self.root.winfo_screenwidth(), self.root.winfo_screenheight(
            )
            self.root.geometry("%dx%d+0+0" % (w, h))

        button = Button(top, text='continue', command=button_hit)
        button.pack()
示例#17
0
	def printFiles(self):

		for pdf in self.PDFs:
			self.jobCounter = ghostscript("\"T:\RELEASED_FILES\CURRENT_PDF\\"+pdf.replace("\"","")+"\"", self.jobCounter, self.selectedPrinter.get(), self.selectedPaper.get(),self.POPENFile)
			#print (jobCounter)

		if self.print_wrong_revision_var.get():
			for pdf in self.wrongRevsion:
				self.jobCounter = ghostscript("\"T:\RELEASED_FILES\CURRENT_PDF\\"+pdf.replace("\"","")+"\"", self.jobCounter, self.selectedPrinter.get(), self.selectedPaper.get(),self.POPENFile)


		#os.remove(self.POPENFile)
		posx  = 500
		posy  = 400
		sizex = 500
		sizey = 100
		top = Toplevel()
		top.title("Done")
		top.grid_rowconfigure(0,weigh=1)
		top.grid_columnconfigure(0, weight=1)
		top.wm_geometry("%dx%d+%d+%d" % (sizex, sizey, posx, posy))
		msg = Message(top, text="Sent all files to printer.\nPlease wait for the printer to finish", width=200, pady=10)
		msg.grid(row=0, column=0, columnspan=4)
		top.focus_force()
		self.current_window = top
		if self.runningInFrozen:
			top.iconbitmap(sys._MEIPASS+r"/emblem_print.ico")
		else:
			top.iconbitmap("emblem_print.ico")
		top.bind("<FocusOut>", self.Alarm)
		button = Button(top,text="Ok", command=top.quit)
		button.grid(row=1, column=0)
示例#18
0
    def __init__(self, master):
        self.master = master
        master.title("Optimus Manager Gui")

        self.warning_label = Label(
            master,
            text=
            "changing graphics configuration requires this to be run as root!")
        self.warning_label.grid(row=2, column=1, columnspan=3)

        self.status_output = Message(master, text="getting status...")
        self.status_output.grid(columnspan=2, row=1, column=1)

        self.intel_button = Button(master,
                                   text="use intel graphics",
                                   command=lambda: self.swapGraphics("intel"))
        self.intel_button.grid(row=3, column=1)

        self.hybrid_button = Button(
            master,
            text="use hybrid graphics",
            command=lambda: self.swapGraphics("hybrid"))
        self.hybrid_button.grid(row=3, column=2)

        self.nvidia_button = Button(
            master,
            text="use nvidia graphics",
            command=lambda: self.swapGraphics("nvidia"))
        self.nvidia_button.grid(row=3, column=3)

        self.quit_button = Button(master, text="quit", command=master.quit)
        self.quit_button.grid(row=4, column=3)

        self.updateStatus()
示例#19
0
    def __init__(self):

        # create the window
        window = Tk()
        window.title("Widget Demo")

        # create the first frame
        frame1 = Frame(window)
        frame1.pack()

        # create variables for buttons and create the buttons
        self.v1 = IntVar()
        cbtBold = Checkbutton(frame1,
                              text="Bold",
                              variable=self.v1,
                              command=self.processCheckbutton)
        self.v2 = IntVar()
        rbRed = Radiobutton(frame1,
                            text="Red",
                            bg="red",
                            variable=self.v2,
                            value=1,
                            command=self.processRadiobutton)
        rbYellow = Radiobutton(frame1,
                               text="Yellow",
                               bg="yellow",
                               variable=self.v2,
                               value=2,
                               command=self.processRadiobutton)

        # set the buttons in the frame
        cbtBold.grid(row=1, column=1)
        rbRed.grid(row=1, column=2)
        rbYellow.grid(row=1, column=3)

        # create the second frame
        frame2 = Frame(window)
        frame2.pack()

        # create labels and entry and button and message
        label = Label(frame2, text="Enter Your Name: ")
        self.name = StringVar()
        entryName = Entry(frame2, textvariable=self.name)
        btGetName = Button(frame2, text="Get Name", command=self.processButton)
        message = Message(frame2, text="This is the Message Widget")

        # position what we just made
        label.grid(row=1, column=1)
        entryName.grid(row=1, column=2)
        btGetName.grid(row=1, column=3)
        message.grid(row=1, column=4)

        # create a text window and add text to it
        text = Text(window)
        text.pack()
        text.insert(END, "Tip\nThe Best way to learn tkinter is to read ")
        text.insert(END, "these carefully designed examples and use them ")
        text.insert(END, "to create your application")

        window.mainloop()
示例#20
0
    def _message_prompt(self, title, text, width=400, height=300, normal=True):
        top = Toplevel(self.root)
        top.geometry("%dx%d%+d%+d" % (width, height, 250, 125))
        top.title(title)
        help_message = text
        msg = Message(top,
                      text=help_message,
                      justify='left',
                      width=width - 100)
        msg.place(relx=0.5, rely=0.4, anchor='center')
        if normal:
            Button(top, text='Dismiss',
                   command=top.destroy).place(relx=0.5,
                                              rely=0.9,
                                              anchor='center')
        else:

            def couple_func():
                top.destroy()
                self.result_dir = filedialog.askdirectory(
                    title='Select a directory to save results ...',
                    mustexist=True)
                self.count_launch()

            Button(top, text='Continue',
                   command=couple_func).place(relx=0.5,
                                              rely=0.8,
                                              anchor='center')
            Button(top, text='Cancel',
                   command=top.destroy).place(relx=0.5,
                                              rely=0.9,
                                              anchor='center')
示例#21
0
    def __init__(self,
                 master,
                 variable,
                 anchor=W,
                 bordercolor=None,
                 borderwidth=1,
                 padx=0,
                 pady=0,
                 background=None,
                 foreground=None,
                 font=None):
        Cell.__init__(self,
                      master,
                      background=background,
                      highlightbackground=bordercolor,
                      highlightcolor=bordercolor,
                      highlightthickness=borderwidth,
                      bd=0)

        self._message_widget = Message(self,
                                       textvariable=variable,
                                       font=font,
                                       background=background,
                                       foreground=foreground)
        self._message_widget.pack(expand=True,
                                  padx=padx,
                                  pady=pady,
                                  anchor=anchor)

        self.bind("<Configure>", self._on_configure)
示例#22
0
    def print_classes(self):
        rowOffset = 0
        label = tk.Label(self.frm, text="Grain Classes:")
        label.grid(row=rowOffset, column=1)
        for k in sorted(self.classesDict.keys()):
            rowOffset += 1
            classDescr = ""
            for grain in self.classesDict[k]:
                classDescr = classDescr + "\n" + grain
            classMsg = Message(self.frm, text=classDescr, width=100)
            classMsg.grid(column=1, row=rowOffset)

        #print("GRAIN_COLS:")
        #print(GRAIN_COLS)

        b_accept = tk.Button(self.frm, text='Accept')
        b_accept['command'] = self.accept
        b_accept.grid(row=rowOffset + 1, column=1)

        if len(self.remaining_grains) == 0:
            b_accept.config(state=NORMAL)
            self.b_remaining.config(state=DISABLED)
            self.b_add.config(state=DISABLED)
        else:
            b_accept.config(state=DISABLED)

        if len(self.classesDict) == 0:
            self.b_reset.config(state=DISABLED)
        else:
            self.b_reset.config(state=NORMAL)
示例#23
0
    def error(self, event=None):
        ''' Displays an error page if a user did not provide all of the required information. '''
        self.l_page.pack_forget()
        self.l_page.destroy()
        self.e_page = Frame(self.master, height=1080, width=1920, bg=self.bg)
        self.e_page.pack()
        self.e_page.focus_set()
        self.e_page.bind("<Return>", self.login_page)
        self.e_page.bind("<Escape>", self.close)


        self.err_title = Label(self.e_page, text="Error: Missing Information", font=("sans serif", 50),
                               bg=self.bg, fg=self.fg, pady=10)
        self.err_title.pack()
        self.err_mss = Message(self.e_page, text="Your submission was missing some data. All fields are rquired.\nPlease return to fill out all fields.",
                               font=("sans serif", 20), width=1900, justify=CENTER, fg=self.fg, bg=self.bg, pady=10)
        self.err_mss.pack()


        self.buttons4 = Frame(self.e_page, width=500, bg=self.bg)
        self.buttons4.pack()
        self.ret = Button(self.buttons4, text="Return", bg="#64e764", fg="#654321", pady=5,
                          activebackground="#bcf5bc", activeforeground="#8b5d2e", command=self.login_page)
        self.ret.grid(row=0, column=0)
        self.cancel = Button(self.buttons4, text="Cancel", bg="#64e764", fg="#654321", pady=5,
                             activebackground="#bcf5bc", activeforeground="#8b5d2e", command=self.master.quit)
        self.cancel.grid(row=0, column=1)
 def make_Message_2(self, frame):
     self.Message_2 = Message(
         frame,
         text=
         "Each widget will still need to set the sticky property (e.g. ns, ew, nsew)",
         width="400")
     self.Message_2.grid(row=7, column=0, columnspan="6")
示例#25
0
文件: UI.py 项目: pbourachot/cours
    def version(self):

        top = Toplevel(root)
        top.title("Au sujet de ce QCM")
        msg = Message(top, text="Version xx")
        msg.pack()
        button = Button(top, text="Fermer", command=top.destroy)
        button.pack()
示例#26
0
文件: Help.py 项目: TheDitis/SpiroGen
    def load_page(self):
        image = Image.open(self.path)
        # get the text and image data from the current page:
        currentpage = self.tutdata[self._currentindex]
        # image = resize_img(image)
        photo = ImageTk.PhotoImage(image)
        # cleanup the last page shown:
        if self._image:
            self._image.grid_forget()
        if self._text:
            self._text.grid_forget()
        if self._titletext:
            self._titletext.grid_forget()

        # if the image is a gif:
        if '.gif' in self.path:
            self._image = GifPlayer(self, borderwidth=2, relief="solid")
            # self.image.image = photo  # keep a reference!
            self._image.grid(row=0, column=0, columnspan=205, rowspan=205)
            self._image.load(self.path)
        # if it's just a still image:
        else:
            self._image = Label(self,
                                image=photo,
                                borderwidth=2,
                                relief="solid")
            self._image.image = photo  # keep a reference!
            self._image.grid(row=0, column=0, columnspan=205, rowspan=205)
        # grab the text:
        title = currentpage['title']
        text = currentpage['text']
        self._titletext = Message(self,
                                  text=title,
                                  font=self.h1,
                                  width=500,
                                  justify='center')
        self._text = Message(self,
                             text=text,
                             font=self.h2,
                             width=500,
                             justify='center')
        # if this is the first or last page, we want the text below the image:
        if "Welcome" in self.path:

            self._titletext.grid(row=210, column=0, columnspan=205, pady=20)
            self._text.grid(row=215, column=0, columnspan=205, pady=20)
        # otherwise, we want it to the side:
        else:
            self._titletext.grid(row=5,
                                 column=300,
                                 columnspan=205,
                                 pady=60,
                                 padx=20)
            self._text.grid(row=10,
                            column=300,
                            columnspan=205,
                            pady=60,
                            padx=20)
示例#27
0
    def messBox(self, title, message):
        top = Toplevel()
        top.title(title)

        msg = Message(top, text=message)
        msg.pack()

        button = Button(top, text="OK", command=top.destroy)
        button.pack()
示例#28
0
    def cmd_analyze(self):
        # analyze
        _top = Toplevel()
        _top.title = '统计结果'
        msg = Message(_top, text=self.get_analyze_result())
        msg.pack()

        button = Button(_top, text="确认", command=_top.destroy)
        button.pack()
示例#29
0
文件: ui.py 项目: hayj/Annotator
 def initTextFrame(self, texts):
     # We init the frame:
     if self.textFrame is not None:
         self.textFrame.destroy()
     self.textFrame = Frame(self)
     self.textFrame.grid(row=0,
                         column=0,
                         columnspan=10,
                         rowspan=10,
                         padx=5,
                         pady=0,
                         sticky="news")
     self.textFrame.rowconfigure(0, weight=0)
     self.textFrame.rowconfigure(1, weight=1)
     # For each text:
     if not isinstance(texts, list):
         texts = [texts]
     nbColumns = len(texts)
     for i in range(nbColumns):
         self.textFrame.columnconfigure(i, weight=1)
         current = texts[i]
         try:
             # We add the head message:
             if dictContains(current, "title"):
                 headMessage = Message(self.textFrame,
                                       text=tkStripExtra(current["title"]),
                                       **self.headMessagesOption)
                 headMessage.grid(row=0,
                                  column=i,
                                  sticky='nwe',
                                  padx=2,
                                  pady=0)
             # We create the area for the text:
             textAreaFrame = Frame(self.textFrame)
             textAreaFrame.columnconfigure(0, weight=1)
             textAreaFrame.rowconfigure(0, weight=1)
             textAreaRow = 1
             textAreaRowspan = 1
             if not dictContains(current, "title"):
                 textAreaRow = 0
                 textAreaRowspan = 2
             textAreaFrame.grid(row=textAreaRow,
                                rowspan=textAreaRowspan,
                                column=i,
                                sticky="news",
                                padx=0)
             # We create the Text widget in:
             textWidget = Text(textAreaFrame)
             textWidget.grid(row=0, column=0, sticky="news")
             textWidget.insert(INSERT, tkStripExtra(current["text"]))
             textWidget.config(state=DISABLED)
             # We make the scroll bar:
             scrollBar = Scrollbar(textAreaFrame, command=textWidget.yview)
             scrollBar.grid(row=0, column=1, sticky="nse")
             textWidget['yscrollcommand'] = scrollBar.set
         except Exception as e:
             logException(e, self)
示例#30
0
    def show_info(self):
        window = Toplevel()
        window['bg'] = 'black'

        grammar = Message(window)
        grammar['fg'] = 'white'
        grammar['bg'] = 'black'
        grammar['text'] = 'Augus intermediate code by Engr. Espino\nTenorC 1.23.2a Developed by @danii_mor\n 201314810'
        grammar.pack(side='left')
示例#31
0
class Scroller(object):
    """
    Scrolls through a solution list.
    """
    def __init__(self, wdw, sols):
        """
        Stores the list of solutions in sols
        and defines the layout of the GUI.
        """
        wdw.title('solutions scroller')
        self.sols = sols
        self.cursor = 0
        self.lbl = Label(wdw, text="solution : ")
        self.lbl.grid(row=0, column=0, sticky=E) 
        self.ent = Entry(wdw)
        self.ent.grid(row=0, column=1, stick=W)
        self.ent.insert(INSERT, "0 of %d" % len(sols))
        self.myft = Font(family="Courier New", size=12, weight="normal")
        self.mlen = self.myft.measure("M")
        lines = sols[0].split('\n')
        self.width = max([len(line) for line in lines])
        self.display = StringVar()
        self.display.set(self.sols[0])
        self.mess = Message(wdw, textvariable=self.display, \
            font=self.myft, width=self.width*self.mlen, background='white')
        self.mess.grid(row=1, column=0, columnspan=2)
        self.btnext = Button(wdw, command=self.next, text='next')
        self.btnext.grid(row=2, column=1, sticky=W+E)
        self.btprev = Button(wdw, command=self.previous, text='previous')
        self.btprev.grid(row=2, column=0, sticky=W+E)

    def show(self):
        """
        Shows the solution at position self.cursor
        in the message widget and updates the entry widget.
        """
        self.display.set(self.sols[self.cursor])
        self.ent.delete(0, END)
        self.ent.insert(INSERT, '%d of %d' % (self.cursor, len(self.sols)))

    def next(self):
        """
        Increases the cursor by one if possible.
        """
        if self.cursor < len(self.sols) - 1:
            self.cursor = self.cursor + 1
        self.show()

    def previous(self):
        """
        Decreases the cursor by one if possible.
        """
        if self.cursor > 0:
            self.cursor = self.cursor - 1
        self.show()
示例#32
0
 def __init__(self, wdw, sols):
     """
     Stores the list of solutions in sols
     and defines the layout of the GUI.
     """
     wdw.title('solutions scroller')
     self.sols = sols
     self.cursor = 0
     self.lbl = Label(wdw, text="solution : ")
     self.lbl.grid(row=0, column=0, sticky=E) 
     self.ent = Entry(wdw)
     self.ent.grid(row=0, column=1, stick=W)
     self.ent.insert(INSERT, "0 of %d" % len(sols))
     self.myft = Font(family="Courier New", size=12, weight="normal")
     self.mlen = self.myft.measure("M")
     lines = sols[0].split('\n')
     self.width = max([len(line) for line in lines])
     self.display = StringVar()
     self.display.set(self.sols[0])
     self.mess = Message(wdw, textvariable=self.display, \
         font=self.myft, width=self.width*self.mlen, background='white')
     self.mess.grid(row=1, column=0, columnspan=2)
     self.btnext = Button(wdw, command=self.next, text='next')
     self.btnext.grid(row=2, column=1, sticky=W+E)
     self.btprev = Button(wdw, command=self.previous, text='previous')
     self.btprev.grid(row=2, column=0, sticky=W+E)
示例#33
0
    def initUI(self, server):
      
        self.parent.title("TrackWise Service Manager")
        self.pack(fill=BOTH, expand = True, padx = 300)
        # self.centerWindow()

        menubar = Menu(self.parent)
        self.parent.config(menu = menubar)

        fileMenu = Menu(menubar)
        fileMenu.add_command(label = "Exit", command = self.onExit)
        menubar.add_cascade(label = "File", menu = fileMenu)

        svcsMenu = Menu(menubar)
        svcsMenu.add_command(label = "List Service Status", command = self.onStatus)
        svcsMenu.add_command(label = "Stop Services", command = self.onStop)
        svcsMenu.add_command(label = "Start Services", command = self.onStart)
        menubar.add_cascade(label = "Services", menu = svcsMenu)

        # svcs = ['TrackWise Tomcat', 'Web Services Tomcat', 'QMD Tomcat', 'Keystone Intake', 'ID Intake', 'TWC']
        svcs = server.getservices()
        hostname = server.gethostname().strip()
        servertype = server.gettype().strip()

        frame0 = Labelframe(self, text = "Server Details",  borderwidth = 1)
        frame0.grid(column = 0, row = 0, sticky = W)
        
        so = StringVar()
        svroverview = Message(frame0, textvariable = so, anchor = W, width = 300)
        svroverview.grid(column = 0, row = 0)
        sstr = "Server: {}\n".format(hostname)
        sstr += "Server Type: {}".format(servertype)
        so.set(sstr)
        
        
        frame1 = Labelframe(self, text = "Service Status", borderwidth = 1)
        frame1.grid(column = 0, row = 1, sticky = W)


        l = StringVar()
        label1 = Message(frame1, textvariable = l , anchor = W)
        
        svcscount = 0

        lstr = ""

        for i in svcs:
            svcscount += 1 
            lstr += '{} - '.format(i) + ('UP\n' if svcscount % 2 else 'DOWN\n')
      
            
        l.set(lstr)
        label1.pack(side=TOP, padx = 5, pady = 5)   

        frame4 = Frame(self, relief=RAISED, borderwidth = 1)
        frame4.grid(column = 0, row = 2, sticky = W)
        closeButton = Button(frame4, text="Close", command = self.quit)
        closeButton.grid(column = 0, row = 0)
        okButton = Button(frame4, text = "OK")
        okButton.grid(column = 1, row = 0)
示例#34
0
    def initUI(self):
      
        self.parent.title("TrackWise Service Manager")
        self.pack(fill=BOTH, expand = True)
        # self.centerWindow()

        menubar = Menu(self.parent)
        self.parent.config(menu = menubar)

        fileMenu = Menu(menubar)
        fileMenu.add_command(label = "Exit", command = self.onExit)
        menubar.add_cascade(label = "File", menu = fileMenu)

        svcsMenu = Menu(menubar)
        svcsMenu.add_command(label = "List Service Status", command = self.onStatus)
        svcsMenu.add_command(label = "Stop Services", command = self.onStop)
        svcsMenu.add_command(label = "Start Services", command = self.onStart)
        menubar.add_cascade(label = "Services", menu = svcsMenu)

        svcs = ['TrackWise Tomcat', 'Web Services Tomcat', 'QMD Tomcat', 'Keystone Intake', 'ID Intake', 'TWC']
        #lb = Listbox(self)
        #for i in svcs:
        #    lb.insert(END, i)

        #lb.bind("<<ListboxSelect>>", self.onSelect)
        #lb.pack(pady = 15)

        #self.var = StringVar()
        #self.label = Label(self, text = 0, textvariable = self.var)
        #self.label.pack()
        
        frame1 = Frame(self, borderwidth = 1)
        frame1.pack(fill = X, anchor = W)

        l = StringVar()
        label1 = Message(frame1, textvariable = l , anchor = W)
        
        svcscount = 0

        lstr = "Service Status\n\n"

        for i in svcs:
            svcscount += 1 
            lstr += '{} - '.format(i) + ('UP\n' if svcscount % 2 else 'DOWN\n')
      
            
        l.set(lstr)
        label1.pack(side=TOP, padx = 5, pady = 5)   

        #entry1 = Entry(frame1)
        #entry1.pack(fill=X, padx = 5, expand = True)

        #frame2 = Frame(self)
        #frame2.pack(fill = X)

        #label2 = Label(frame2, text = "Author", width = 6)
        #label2.pack(side=LEFT, padx = 5, pady = 5)

        #entry2 = Entry(frame2)
        #entry2.pack(fill=X, padx = 5, expand = True)

        #frame3 = Frame(self)
        #frame3.pack(fill = X)

        #label3 = Label(frame3, text = "Review", width = 6)
        #label3.pack(side=LEFT, anchor = N, padx = 5, pady = 5)

        #txt = Text(frame3)
        #txt.pack(fill=X, padx = 5, expand = True)

        frame4 = Frame(self, relief=RAISED, borderwidth = 1)
        frame4.pack(fill = X)
        closeButton = Button(frame4, text="Close", command = self.quit)
        closeButton.pack(side = RIGHT, padx = 5, pady = 5)
        okButton = Button(frame4, text = "OK")
        okButton.pack(side = RIGHT) 
示例#35
0
文件: medium.py 项目: paulogp/Python
"""
Tkinter example: Window size, title, label and message.
"""

from tkinter import Tk, Label, Message

__author__ = "paulogp"
__copyright__ = "Copyright (C) 2015 Paulo G.P."
__date__ = "16/12/2015"

if __name__ == "__main__":
    root = Tk()
    # title
    root.title("Tkinter Title")
    # size
    root.geometry("300x150+50+50")
    # label
    label1 = Label(root, text="One Label")
    label1.pack(padx=0, ipady=20)
    # text
    msg = Message(root, text="Hello, world!")
    msg.config(font=("times", 12, "italic bold underline"))
    msg.pack()
    # do
    root.mainloop()
示例#36
0
文件: Ui.py 项目: mymysonday/python
    def __init__(self):
        win = Tk()
        win.title("日志文件解析器")
        frame1 = Frame(win)
        frame1.pack()
        self.data_from = StringVar()
        self.data_To =StringVar()
        self.status = StringVar()
        
#       文件来源选择框
        entry_from = Entry(frame1,textvariable=self.data_from)
        mess_f = Message(frame1,text="文件读取路径")
        entry_to =Entry(frame1,textvariable=self.data_To)
        mess_t = Message(frame1,text="文件写入路径")
        self.setTatus_1()
        mess_s = Message(frame1,textvariable=self.status)
        
        button_f = Button(frame1,text="readPath",command=self.read_Path)
        button_to = Button(frame1,text="WritePath",command=self.write_Path)
        button_st = Button(frame1,text="Start_Operation",command=self.start_operation)
        
#       设置位置
        mess_f.grid(row=2,column=1,columnspan=2)
        entry_from.grid(row=2,column=3,columnspan=2)
        button_f.grid(row=2,column=5,columnspan=2)
        
        mess_t.grid(row=3,column=1,columnspan=2)
        entry_to.grid(row=3,column=3,columnspan=2)
        button_to.grid(row=3,column=5,columnspan=2)
        
        mess_s.grid(row=4,rowspan=2,column=3)
        button_st.grid(row=6,column=3)
#        填充
        newM = Message(frame1)
        newM.grid(row=7,rowspan=2)
        win.mainloop()