Hi all,
I'm working as a Co-op student at my university on a telescope
project. The idea is to place the telescope in a remote location far
away, and operate it via the internet from here. Part of my work
involves writing a GUI with wxpython to run some pre-existing scripts
for the telescope. I'd like to create a help directory, where users
who haven't used the GUI before will know what each of the buttons do.
I've only been using Python for a few days now, but I've managed to
create a tree structure that will separate various help topics.
However, when the help directory is launched, I'd like more text to be
able seen after clicking on a particular item in the tree. For
example, if they clicked on 'Begin Imaging', I'd like to have a
description in the right hand side of what 'Begin Imaging' refers to.
I haven't found any way to do this yet. Would anyone be so kind to
help me?
Below is the class for the help directory that I've created. One
should be able to copy, paste, and run in a terminal. Any help would
be greatly appreciated!
Thanks!
···
----------------------------------------------------------------------------
import wx
import wx.gizmos as gizmos
class Help(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, wx.DefaultPosition,
wx.Size(600, 450))
hbox = wx.BoxSizer(wx.HORIZONTAL)
vbox = wx.BoxSizer(wx.VERTICAL)
panel1 = wx.Panel(self, -1)
panel2 = wx.Panel(self, -1)
self.tree = wx.TreeCtrl(panel1, 1, wx.DefaultPosition,
(-1,-1), wx.TR_HIDE_ROOT|wx.TR_HAS_BUTTONS)
root = self.tree.AddRoot('Anything')
TI = self.tree.AppendItem(root, 'Telescope Information')
WS = self.tree.AppendItem(root, 'Weather Station')
CT = self.tree.AppendItem(root, 'Check Telescope')
TO = self.tree.AppendItem(root, 'Telescope Operation')
self.tree.AppendItem(WS, 'Temperature')
self.tree.AppendItem(WS, 'Humidity')
self.tree.AppendItem(WS, 'Wind Speed')
self.tree.AppendItem(WS, 'Wind Direction')
self.tree.AppendItem(WS, 'Pressure')
self.tree.AppendItem(WS, 'Rain Fall')
self.tree.AppendItem(CT, 'Dome Status')
self.tree.AppendItem(CT, 'Power Cabinet Status')
self.tree.AppendItem(CT, 'NPS Status')
self.tree.AppendItem(CT, 'Emergency Switch Status')
self.tree.AppendItem(TO, 'Open/Close Dome')
self.tree.AppendItem(TO, 'Point RA/DEC')
self.tree.AppendItem(TO, 'Track Star')
self.tree.AppendItem(TO, 'Park Telescope')
self.tree.AppendItem(TO, 'Begin Imaging')
self.tree.AppendItem(TO, 'Filters')
self.tree.AppendItem(TO, 'Shutdown')
self.tree.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelChanged,
id=1)
self.display = wx.StaticText(panel2, -1, 'Welcome to the Help
Directory! \n\nClick on a topic at the left to view \nits contents',
(10,10), style=wx.ALIGN_LEFT)
vbox.Add(self.tree, 1, wx.EXPAND)
hbox.Add(panel1, 1, wx.EXPAND)
hbox.Add(panel2, 1, wx.EXPAND)
panel1.SetSizer(vbox)
self.SetSizer(hbox)
self.Centre()
self.Show(True)
def OnSelChanged(self, event):
item = event.GetItem()
self.display.SetLabel(self.tree.GetItemText(item))
app = wx.PySimpleApp()
Frame = Help(None, -1,'Help Directory')
app.MainLoop()