[BangPypers] [ onClick run python script ]

Binoy Mathew binoy2005 at gmail.com
Tue Apr 15 15:08:33 CEST 2014

Hi Shashi,

See the below code...

from Tkinter import Tk, Text, BOTH, W, N, E, S, INSERT
from ttk import Frame, Button, Label, Style

class Ui_app_class(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.parent = parent

    def initUI(self):
        self.parent.title("Run Script")
        self.style = Style()
        self.pack(fill=BOTH, expand=1)

        self.columnconfigure(1, weight=1)
        self.columnconfigure(3, pad=7)
        self.rowconfigure(3, weight=1)
        self.rowconfigure(5, pad=7)

        lbl = Label(self, text="Logs")
        lbl.grid(sticky=W, pady=4, padx=5)

        area = Text(self)
        area.grid(row=1, column=0, columnspan=2, rowspan=4,
            padx=5, sticky=E+W+S+N)
        self.area = area
        rbtn = Button(self, text="Run", command=self.onRunClicked)
        rbtn.grid(row=5, column=0, padx=5)

        cbtn = Button(self, text="Close", command=self.onCloseClicked)
        cbtn.grid(row=5, column=3)

    def onCloseClicked(self):

    def onRunClicked(self):
        self.area.insert(INSERT, "Started running script....\n")
        self.area.insert(INSERT, "Script ended....\n")

    def runScript(self):
        ### your script here ----------
        ### you can print log/debug text in the log window like this.
        self.area.insert(INSERT, "script logs....\n")

def main():
    root = Tk()
    app = Ui_app_class(root)

if __name__ == '__main__':

just call your parser inside runScript() function.

Binoy Mathew

On Tue, Apr 15, 2014 at 4:47 PM, Shashidhar Paragonda <
shashidhar85 at gmail.com> wrote:

> Hello Python hackers,
> >>> I have written a HP Quality Center manual test case parser program to
> do some task.
> >>>  My requirement is, there will be a button say execute for each manual
> test case in test lab.
> >>> When user click on execute button I need to execute my python parser
> program.
> >>> Does anyone have idea how to first get the flow to connect with execute
> button and run the python program.
> >>> Thanks in advance.
> -----------------------------------
> Regards,
> Shashidhar N.Paragonda
> shashidhar85 at gmail.com
> +919900093835
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> https://mail.python.org/mailman/listinfo/bangpypers

More information about the BangPypers mailing list