2

I use a python script record.py to record certain events.

The command work in this way:

python record.py <scriptname>

It stores the the script in local disk. Later you can replay the recorded script by simply saying:

python scriptname.py

All these actions (described above work correctly) but are done through command line (linux Terminal).

I want to make a GUI with two tabs (Record, Play):

  1. Record Tab: Has a textbox (for <scriptname>) and a button named record (which is linked with record.py script)

  2. Play Tab: Has a feature to include all the scripts that were recorded and button called play to run either a single script or entire bunch of scripts.

2
  • What do you need help with exactly? Building the GUI? Deciding what type of GUI framework to use? Hooking up events in the GUI you've built already? Commented Apr 28, 2011 at 18:02
  • Daniel, I need help to make GUI and hook up events with it. and I have no knowledge of python GUI development. Commented Apr 30, 2011 at 18:17

2 Answers 2

4

Daniel,

I suggest wxPython as well.

If you decide to go with wxPython, here is a broad outline of how you would make the tabs work. It requires you to fill in some blanks, but once you grasp the basics of wxPython, this will show you how to build a "Notebook" with tabs.

What you would basically do would be to have a main script (an outline of which is represented in the code sample as follows) and then have each panel represented as a separate file (in this example there is: panel1.py, panel2.py, panel3.py etc.). And the main script would run the individual panels through wxPython.

Your main script that handles the entire window would look something like this:

from wxPython.wx import *

class MainFrame(wxFrame):
        .
        .
        .

        def __init__(self, parent, id, title):
                .
                .
                .

                # Create the Notebook
                self.nb = wxNotebook(self, -1, wxPoint(0,0), wxSize(0,0), wxNB_FIXEDWIDTH)

                # Make PANEL_1 (filename: panel1.py)

                self.module = __import__("panel1", globals())
                self.window = self.module.runPanel(self, self.nb)

                if self.window:
                        self.nb.AddPage(self.window, "PANEL_1")


                # Make PANEL_2 (filename: panel2.py)

                self.module = __import__("panel2", globals())
                self.window = self.module.runPanel(self, self.nb)

                if self.window:
                        self.nb.AddPage(self.window, "PANEL_2")


                # Make PANEL_3 (filename: panel3.py)

                self.module = __import__("panel3", globals())
                self.window = self.module.runPanel(self, self.nb)

                if self.window:
                        self.nb.AddPage(self.window, "PANEL_3")

                .
                .
                .

But I must emphasize.... don't try the tabs right away, grasp the principles of how wxPython works first.

Sign up to request clarification or add additional context in comments.

Comments

3

http://www.wxpython.org/ might help.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.