[BangPypers] [ onClick run python script ]
konark modi
modi.konark at gmail.com
Tue Apr 15 15:15:16 CEST 2014
Hi Shashidhar,
Although you have listed a very small requirement in terms of feature set,
I believe same can expedite to a complex and interesting scenario.
If it is a web application do look into systems like : Jobtastic [
http://policystat.github.io/jobtastic/ ] which is meant for running user
responsive tasks of both small and long duration.
Regards
Konark
On Tue, Apr 15, 2014 at 6:38 PM, Binoy Mathew <binoy2005 at gmail.com> wrote:
> 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
> self.initUI()
>
> def initUI(self):
> self.parent.title("Run Script")
> self.style = Style()
> self.style.theme_use("default")
> 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):
> self.parent.destroy()
>
> def onRunClicked(self):
> self.area.insert(INSERT, "Started running script....\n")
> self.runScript()
> 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()
> root.geometry("350x300+300+300")
> app = Ui_app_class(root)
> root.mainloop()
>
> if __name__ == '__main__':
> main()
>
>
> just call your parser inside runScript() function.
>
> Regards,
> 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
> >
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> https://mail.python.org/mailman/listinfo/bangpypers
>
More information about the BangPypers
mailing list