Top

pyMez.Code.FrontEnds.VisaDialog module

VisaDialog is a very simple dialog for writing and reading commands over GPIB and RS232 Help


pyMez.Code.FrontEnds

Documentation Home | API Documentation Home | Examples Home | Index

#-----------------------------------------------------------------------------
# Name:        VisaDialog.py
# Purpose:     To comunicate with visa compatible instruments
# Author:      Aric Sanders
# Created:     3/02/2016
# License:     MIT License
#-----------------------------------------------------------------------------
""" VisaDialog is a very simple dialog for writing and reading commands over GPIB and RS232
Help
---------------
<a href="./index.html">`pyMez.Code.FrontEnds`</a>
<div>
<a href="../../../pyMez_Documentation.html">Documentation Home</a> |
<a href="../../index.html">API Documentation Home</a> |
<a href="../../../Examples/html/Examples_Home.html">Examples Home</a> |
<a href="../../../Reference_Index.html">Index</a>
</div>"""
#Boa:Dialog:VisaDialog
try:
    import wx
except:
    raise

try:
    import visa
except:
    raise

def create(parent):
    return VisaDialog(parent)

[wxID_VISADIALOG, wxID_VISADIALOGASKBUTTON, wxID_VISADIALOGCOMMANDPANEL, 
 wxID_VISADIALOGINPUTLABEL, wxID_VISADIALOGINSTRUMENTCHOICE, 
 wxID_VISADIALOGINSTRUMENTCHOOSERPANEL, wxID_VISADIALOGINSTRUMENTLABEL, 
 wxID_VISADIALOGREADBUTTON, wxID_VISADIALOGRESPONSELABEL, 
 wxID_VISADIALOGRESPONSETEXT, wxID_VISADIALOGTEXTINPUT, 
 wxID_VISADIALOGTEXTPANEL, wxID_VISADIALOGWRITEBUTTON, 
] = [wx.NewId() for _init_ctrls in range(13)]

class VisaDialog(wx.Dialog):
    def _init_coll_LabelSizer_Items(self, parent):
        # generated method, don't edit

        parent.Add(self.InputLabel, 1, border=2, flag=wx.GROW | wx.EXPAND)
        parent.Add(self.ResponseLabel, 1, border=2,
              flag=wx.GROW | wx.EXPAND)

    def _init_coll_InstrumentChooserSizer_Items(self, parent):
        # generated method, don't edit

        parent.Add(self.InstrumentLabel, 1, border=1,
              flag=wx.ALIGN_CENTER_VERTICAL | wx.GROW | wx.EXPAND | wx.ALIGN_RIGHT)
        parent.Add(self.InstrumentChoice, 1, border=4,
              flag=wx.EXPAND | wx.LEFT)
        parent.Add(self.LabelSizer, 1, border=0,
              flag=wx.BOTTOM | wx.EXPAND)

    def _init_coll_CommandSizer_Items(self, parent):
        # generated method, don't edit

        parent.Add(self.ButtonSizer1, 0, border=0, flag=wx.ALIGN_CENTER)
        parent.Add(self.AskButton, 0, border=0, flag=wx.ALIGN_CENTER)

    def _init_coll_TextPanelSizer_Items(self, parent):
        # generated method, don't edit

        parent.Add(self.TextInput, 1, border=0, flag=wx.EXPAND)
        parent.Add(self.ResponseText, 1, border=1, flag=wx.EXPAND)

    def _init_coll_ButtonSizer1_Items(self, parent):
        # generated method, don't edit

        parent.Add(self.WriteButton, 0, border=0, flag=0)
        parent.Add(self.ReadButton, 0, border=0, flag=0)

    def _init_coll_DialogSizer_Items(self, parent):
        # generated method, don't edit

        parent.Add(self.InstrumentChooserPanel, 4, border=1,
              flag=wx.ALL | wx.EXPAND)
        parent.Add(self.TextPanel, 9, border=1, flag=wx.GROW | wx.EXPAND)
        parent.Add(self.CommandPanel, 3, border=2,
              flag=wx.GROW | wx.EXPAND)

    def _init_sizers(self):
        # generated method, don't edit
        self.DialogSizer = wx.BoxSizer(orient=wx.VERTICAL)

        self.TextPanelSizer = wx.BoxSizer(orient=wx.HORIZONTAL)

        self.InstrumentChooserSizer = wx.BoxSizer(orient=wx.VERTICAL)

        self.CommandSizer = wx.BoxSizer(orient=wx.VERTICAL)

        self.ButtonSizer1 = wx.BoxSizer(orient=wx.HORIZONTAL)

        self.LabelSizer = wx.BoxSizer(orient=wx.HORIZONTAL)

        self._init_coll_DialogSizer_Items(self.DialogSizer)
        self._init_coll_TextPanelSizer_Items(self.TextPanelSizer)
        self._init_coll_InstrumentChooserSizer_Items(self.InstrumentChooserSizer)
        self._init_coll_CommandSizer_Items(self.CommandSizer)
        self._init_coll_ButtonSizer1_Items(self.ButtonSizer1)
        self._init_coll_LabelSizer_Items(self.LabelSizer)

        self.SetSizer(self.DialogSizer)
        self.TextPanel.SetSizer(self.TextPanelSizer)
        self.InstrumentChooserPanel.SetSizer(self.InstrumentChooserSizer)
        self.CommandPanel.SetSizer(self.CommandSizer)

    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Dialog.__init__(self, id=wxID_VISADIALOG, name='VisaDialog',
              parent=prnt, pos=wx.Point(366, 357), size=wx.Size(966, 336),
              style=wx.DEFAULT_DIALOG_STYLE,
              title='Visa Communication Window')
        self.SetClientSize(wx.Size(958, 302))
        self.SetHelpText('')

        self.InstrumentChooserPanel = wx.Panel(id=wxID_VISADIALOGINSTRUMENTCHOOSERPANEL,
              name='InstrumentChooserPanel', parent=self, pos=wx.Point(1, 1),
              size=wx.Size(956, 73), style=wx.TAB_TRAVERSAL)

        self.TextPanel = wx.Panel(id=wxID_VISADIALOGTEXTPANEL,
              name='TextPanel', parent=self, pos=wx.Point(0, 75),
              size=wx.Size(958, 170), style=wx.TAB_TRAVERSAL)

        self.CommandPanel = wx.Panel(id=wxID_VISADIALOGCOMMANDPANEL,
              name='CommandPanel', parent=self, pos=wx.Point(0, 245),
              size=wx.Size(958, 57), style=wx.TAB_TRAVERSAL)

        self.InstrumentChoice = wx.Choice(choices=[],
              id=wxID_VISADIALOGINSTRUMENTCHOICE, name='InstrumentChoice',
              parent=self.InstrumentChooserPanel, pos=wx.Point(4, 24),
              size=wx.Size(952, 21), style=wx.SUNKEN_BORDER)
        self.InstrumentChoice.SetHelpText('Choose Instrument')
        self.InstrumentChoice.Bind(wx.EVT_CHOICE, self.OnInstrumentChoiceChoice,
              id=wxID_VISADIALOGINSTRUMENTCHOICE)

        self.TextInput = wx.TextCtrl(id=wxID_VISADIALOGTEXTINPUT,
              name='TextInput', parent=self.TextPanel, pos=wx.Point(0, 0),
              size=wx.Size(479, 170), style=wx.RAISED_BORDER ,
              value='Input Command Here')
        self.TextInput.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.NORMAL,
              False, 'MS Shell Dlg 2'))

        self.ResponseText = wx.TextCtrl(id=wxID_VISADIALOGRESPONSETEXT,
              name='ResponseText', parent=self.TextPanel, pos=wx.Point(479, 0),
              size=wx.Size(479, 170),
              style=wx.RAISED_BORDER  | wx.TE_MULTILINE,
              value='Instrument Response')
        self.ResponseText.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.NORMAL,
              False, 'MS Shell Dlg 2'))

        self.WriteButton = wx.Button(id=wxID_VISADIALOGWRITEBUTTON,
              label='Write', name='WriteButton', parent=self.CommandPanel,
              pos=wx.Point(404, 0), size=wx.Size(75, 23), style=0)
        self.WriteButton.Bind(wx.EVT_BUTTON, self.OnWriteButtonButton,
              id=wxID_VISADIALOGWRITEBUTTON)

        self.ReadButton = wx.Button(id=wxID_VISADIALOGREADBUTTON, label='Read',
              name='ReadButton', parent=self.CommandPanel, pos=wx.Point(479,
              0), size=wx.Size(75, 23), style=0)
        self.ReadButton.Bind(wx.EVT_BUTTON, self.OnReadButtonButton,
              id=wxID_VISADIALOGREADBUTTON)

        self.AskButton = wx.Button(id=wxID_VISADIALOGASKBUTTON, label='Ask',
              name='AskButton', parent=self.CommandPanel, pos=wx.Point(441,
              23), size=wx.Size(75, 23), style=0)
        self.AskButton.Bind(wx.EVT_BUTTON, self.OnAskButtonButton,
              id=wxID_VISADIALOGASKBUTTON)

        self.InputLabel = wx.StaticText(id=wxID_VISADIALOGINPUTLABEL,
              label='Command Written to Instrument', name='InputLabel',
              parent=self.InstrumentChooserPanel, pos=wx.Point(0, 48),
              size=wx.Size(478, 25), style=0)
        self.InputLabel.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.NORMAL,
              False, 'MS Shell Dlg 2'))

        self.ResponseLabel = wx.StaticText(id=wxID_VISADIALOGRESPONSELABEL,
              label='Response', name='ResponseLabel',
              parent=self.InstrumentChooserPanel, pos=wx.Point(478, 48),
              size=wx.Size(478, 25), style=0)
        self.ResponseLabel.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.NORMAL,
              False, 'MS Shell Dlg 2'))

        self.InstrumentLabel = wx.StaticText(id=wxID_VISADIALOGINSTRUMENTLABEL,
              label='Instrument', name='InstrumentLabel',
              parent=self.InstrumentChooserPanel, pos=wx.Point(0, 0),
              size=wx.Size(956, 24), style=0)
        self.InstrumentLabel.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD,
              False, 'MS Shell Dlg 2'))

        self._init_sizers()

    def __init__(self, parent):
        self._init_ctrls(parent)
        
        # Look for visa instruments
        self.resource_manager=visa.ResourceManager()

        self.instrument_list=self.resource_manager.list_resources()
        for instrument in self.instrument_list:
            self.InstrumentChoice.Append(instrument)

    def OnInstrumentChoiceChoice(self, event):
        
        address=self.InstrumentChoice.GetStringSelection()
        #print address
        self.active_instrument=self.resource_manager.open_resource(address)
        event.Skip()

    def OnWriteButtonButton(self, event):
        self.active_instrument.write(self.TextInput.GetValue())
        event.Skip()

    def OnReadButtonButton(self, event):
        text=self.active_instrument.read()
        self.ResponseText.SetValue(text)
        event.Skip()

    def OnAskButtonButton(self, event):
        input=self.TextInput.GetValue()
        output=self.active_instrument.query(input)
        self.ResponseText.SetValue(output)
        event.Skip()


if __name__ == '__main__':
    app = wx.App()
    dlg = create(None)
    try:
        dlg.ShowModal()
    finally:
        dlg.Destroy()
    app.MainLoop()

Functions

def create(

parent)

def create(parent):
    return VisaDialog(parent)

Classes

class VisaDialog

Dialog() Dialog(parent, id=ID_ANY, title=EmptyString, pos=DefaultPosition, size=DefaultSize, style=DEFAULT_DIALOG_STYLE, name=DialogNameStr)

A dialog box is a window with a title bar and sometimes a system menu, which can be moved around the screen.

class VisaDialog(wx.Dialog):
    def _init_coll_LabelSizer_Items(self, parent):
        # generated method, don't edit

        parent.Add(self.InputLabel, 1, border=2, flag=wx.GROW | wx.EXPAND)
        parent.Add(self.ResponseLabel, 1, border=2,
              flag=wx.GROW | wx.EXPAND)

    def _init_coll_InstrumentChooserSizer_Items(self, parent):
        # generated method, don't edit

        parent.Add(self.InstrumentLabel, 1, border=1,
              flag=wx.ALIGN_CENTER_VERTICAL | wx.GROW | wx.EXPAND | wx.ALIGN_RIGHT)
        parent.Add(self.InstrumentChoice, 1, border=4,
              flag=wx.EXPAND | wx.LEFT)
        parent.Add(self.LabelSizer, 1, border=0,
              flag=wx.BOTTOM | wx.EXPAND)

    def _init_coll_CommandSizer_Items(self, parent):
        # generated method, don't edit

        parent.Add(self.ButtonSizer1, 0, border=0, flag=wx.ALIGN_CENTER)
        parent.Add(self.AskButton, 0, border=0, flag=wx.ALIGN_CENTER)

    def _init_coll_TextPanelSizer_Items(self, parent):
        # generated method, don't edit

        parent.Add(self.TextInput, 1, border=0, flag=wx.EXPAND)
        parent.Add(self.ResponseText, 1, border=1, flag=wx.EXPAND)

    def _init_coll_ButtonSizer1_Items(self, parent):
        # generated method, don't edit

        parent.Add(self.WriteButton, 0, border=0, flag=0)
        parent.Add(self.ReadButton, 0, border=0, flag=0)

    def _init_coll_DialogSizer_Items(self, parent):
        # generated method, don't edit

        parent.Add(self.InstrumentChooserPanel, 4, border=1,
              flag=wx.ALL | wx.EXPAND)
        parent.Add(self.TextPanel, 9, border=1, flag=wx.GROW | wx.EXPAND)
        parent.Add(self.CommandPanel, 3, border=2,
              flag=wx.GROW | wx.EXPAND)

    def _init_sizers(self):
        # generated method, don't edit
        self.DialogSizer = wx.BoxSizer(orient=wx.VERTICAL)

        self.TextPanelSizer = wx.BoxSizer(orient=wx.HORIZONTAL)

        self.InstrumentChooserSizer = wx.BoxSizer(orient=wx.VERTICAL)

        self.CommandSizer = wx.BoxSizer(orient=wx.VERTICAL)

        self.ButtonSizer1 = wx.BoxSizer(orient=wx.HORIZONTAL)

        self.LabelSizer = wx.BoxSizer(orient=wx.HORIZONTAL)

        self._init_coll_DialogSizer_Items(self.DialogSizer)
        self._init_coll_TextPanelSizer_Items(self.TextPanelSizer)
        self._init_coll_InstrumentChooserSizer_Items(self.InstrumentChooserSizer)
        self._init_coll_CommandSizer_Items(self.CommandSizer)
        self._init_coll_ButtonSizer1_Items(self.ButtonSizer1)
        self._init_coll_LabelSizer_Items(self.LabelSizer)

        self.SetSizer(self.DialogSizer)
        self.TextPanel.SetSizer(self.TextPanelSizer)
        self.InstrumentChooserPanel.SetSizer(self.InstrumentChooserSizer)
        self.CommandPanel.SetSizer(self.CommandSizer)

    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Dialog.__init__(self, id=wxID_VISADIALOG, name='VisaDialog',
              parent=prnt, pos=wx.Point(366, 357), size=wx.Size(966, 336),
              style=wx.DEFAULT_DIALOG_STYLE,
              title='Visa Communication Window')
        self.SetClientSize(wx.Size(958, 302))
        self.SetHelpText('')

        self.InstrumentChooserPanel = wx.Panel(id=wxID_VISADIALOGINSTRUMENTCHOOSERPANEL,
              name='InstrumentChooserPanel', parent=self, pos=wx.Point(1, 1),
              size=wx.Size(956, 73), style=wx.TAB_TRAVERSAL)

        self.TextPanel = wx.Panel(id=wxID_VISADIALOGTEXTPANEL,
              name='TextPanel', parent=self, pos=wx.Point(0, 75),
              size=wx.Size(958, 170), style=wx.TAB_TRAVERSAL)

        self.CommandPanel = wx.Panel(id=wxID_VISADIALOGCOMMANDPANEL,
              name='CommandPanel', parent=self, pos=wx.Point(0, 245),
              size=wx.Size(958, 57), style=wx.TAB_TRAVERSAL)

        self.InstrumentChoice = wx.Choice(choices=[],
              id=wxID_VISADIALOGINSTRUMENTCHOICE, name='InstrumentChoice',
              parent=self.InstrumentChooserPanel, pos=wx.Point(4, 24),
              size=wx.Size(952, 21), style=wx.SUNKEN_BORDER)
        self.InstrumentChoice.SetHelpText('Choose Instrument')
        self.InstrumentChoice.Bind(wx.EVT_CHOICE, self.OnInstrumentChoiceChoice,
              id=wxID_VISADIALOGINSTRUMENTCHOICE)

        self.TextInput = wx.TextCtrl(id=wxID_VISADIALOGTEXTINPUT,
              name='TextInput', parent=self.TextPanel, pos=wx.Point(0, 0),
              size=wx.Size(479, 170), style=wx.RAISED_BORDER ,
              value='Input Command Here')
        self.TextInput.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.NORMAL,
              False, 'MS Shell Dlg 2'))

        self.ResponseText = wx.TextCtrl(id=wxID_VISADIALOGRESPONSETEXT,
              name='ResponseText', parent=self.TextPanel, pos=wx.Point(479, 0),
              size=wx.Size(479, 170),
              style=wx.RAISED_BORDER  | wx.TE_MULTILINE,
              value='Instrument Response')
        self.ResponseText.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.NORMAL,
              False, 'MS Shell Dlg 2'))

        self.WriteButton = wx.Button(id=wxID_VISADIALOGWRITEBUTTON,
              label='Write', name='WriteButton', parent=self.CommandPanel,
              pos=wx.Point(404, 0), size=wx.Size(75, 23), style=0)
        self.WriteButton.Bind(wx.EVT_BUTTON, self.OnWriteButtonButton,
              id=wxID_VISADIALOGWRITEBUTTON)

        self.ReadButton = wx.Button(id=wxID_VISADIALOGREADBUTTON, label='Read',
              name='ReadButton', parent=self.CommandPanel, pos=wx.Point(479,
              0), size=wx.Size(75, 23), style=0)
        self.ReadButton.Bind(wx.EVT_BUTTON, self.OnReadButtonButton,
              id=wxID_VISADIALOGREADBUTTON)

        self.AskButton = wx.Button(id=wxID_VISADIALOGASKBUTTON, label='Ask',
              name='AskButton', parent=self.CommandPanel, pos=wx.Point(441,
              23), size=wx.Size(75, 23), style=0)
        self.AskButton.Bind(wx.EVT_BUTTON, self.OnAskButtonButton,
              id=wxID_VISADIALOGASKBUTTON)

        self.InputLabel = wx.StaticText(id=wxID_VISADIALOGINPUTLABEL,
              label='Command Written to Instrument', name='InputLabel',
              parent=self.InstrumentChooserPanel, pos=wx.Point(0, 48),
              size=wx.Size(478, 25), style=0)
        self.InputLabel.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.NORMAL,
              False, 'MS Shell Dlg 2'))

        self.ResponseLabel = wx.StaticText(id=wxID_VISADIALOGRESPONSELABEL,
              label='Response', name='ResponseLabel',
              parent=self.InstrumentChooserPanel, pos=wx.Point(478, 48),
              size=wx.Size(478, 25), style=0)
        self.ResponseLabel.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.NORMAL,
              False, 'MS Shell Dlg 2'))

        self.InstrumentLabel = wx.StaticText(id=wxID_VISADIALOGINSTRUMENTLABEL,
              label='Instrument', name='InstrumentLabel',
              parent=self.InstrumentChooserPanel, pos=wx.Point(0, 0),
              size=wx.Size(956, 24), style=0)
        self.InstrumentLabel.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD,
              False, 'MS Shell Dlg 2'))

        self._init_sizers()

    def __init__(self, parent):
        self._init_ctrls(parent)
        
        # Look for visa instruments
        self.resource_manager=visa.ResourceManager()

        self.instrument_list=self.resource_manager.list_resources()
        for instrument in self.instrument_list:
            self.InstrumentChoice.Append(instrument)

    def OnInstrumentChoiceChoice(self, event):
        
        address=self.InstrumentChoice.GetStringSelection()
        #print address
        self.active_instrument=self.resource_manager.open_resource(address)
        event.Skip()

    def OnWriteButtonButton(self, event):
        self.active_instrument.write(self.TextInput.GetValue())
        event.Skip()

    def OnReadButtonButton(self, event):
        text=self.active_instrument.read()
        self.ResponseText.SetValue(text)
        event.Skip()

    def OnAskButtonButton(self, event):
        input=self.TextInput.GetValue()
        output=self.active_instrument.query(input)
        self.ResponseText.SetValue(output)
        event.Skip()

Ancestors (in MRO)

  • VisaDialog
  • wx._core.Dialog
  • wx._core.TopLevelWindow
  • wx._core.NonOwnedWindow
  • wx._core.Window
  • wx._core.WindowBase
  • wx._core.EvtHandler
  • wx._core.Object
  • wx._core.Trackable
  • sip.wrapper
  • sip.simplewrapper
  • builtins.object

Class variables

var ChildrenRepositioningGuard

Static methods

def __init__(

self, parent)

Initialize self. See help(type(self)) for accurate signature.

def __init__(self, parent):
    self._init_ctrls(parent)
    
    # Look for visa instruments
    self.resource_manager=visa.ResourceManager()
    self.instrument_list=self.resource_manager.list_resources()
    for instrument in self.instrument_list:
        self.InstrumentChoice.Append(instrument)

def Bind(

self, event, handler, source=None, id=-1, id2=-1)

Bind an event to an event handler.

:param event: One of the EVT_* event binder objects that specifies the type of event to bind.

:param handler: A callable object to be invoked when the event is delivered to self. Pass None to disconnect an event handler.

:param source: Sometimes the event originates from a different window than self, but you still want to catch it in self. (For example, a button event delivered to a frame.) By passing the source of the event, the event handling system is able to differentiate between the same event type from different controls.

:param id: Used to spcify the event source by ID instead of instance.

:param id2: Used when it is desirable to bind a handler to a range of IDs, such as with EVT_MENU_RANGE.

def _EvtHandler_Bind(self, event, handler, source=None, id=wx.ID_ANY, id2=wx.ID_ANY):
    """
    Bind an event to an event handler.
    
    :param event: One of the ``EVT_*`` event binder objects that
                  specifies the type of event to bind.
    
    :param handler: A callable object to be invoked when the
                    event is delivered to self.  Pass ``None`` to
                    disconnect an event handler.
    
    :param source: Sometimes the event originates from a
                   different window than self, but you still
                   want to catch it in self.  (For example, a
                   button event delivered to a frame.)  By
                   passing the source of the event, the event
                   handling system is able to differentiate
                   between the same event type from different
                   controls.
    
    :param id: Used to spcify the event source by ID instead
               of instance.
    
    :param id2: Used when it is desirable to bind a handler
                to a range of IDs, such as with EVT_MENU_RANGE.
    """
    assert isinstance(event, wx.PyEventBinder)
    assert callable(handler) or handler is None
    assert source is None or hasattr(source, 'GetId')
    if source is not None:
        id  = source.GetId()
    event.Bind(self, id, id2, handler)

def ConvertDialogPointToPixels(

*args, **kw)

def deprecated_func(*args, **kw):
    warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                  wxPyDeprecationWarning, stacklevel=2)
    if not kw:
        return item(*args)
    return item(*args, **kw)

def ConvertDialogSizeToPixels(

*args, **kw)

def deprecated_func(*args, **kw):
    warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                  wxPyDeprecationWarning, stacklevel=2)
    if not kw:
        return item(*args)
    return item(*args, **kw)

def DLG_UNIT(

self, dlg_unit)

A convenience wrapper for :meth:ConvertDialogToPixels.

def _Window_DLG_UNIT(self, dlg_unit):
    """
    A convenience wrapper for :meth:`ConvertDialogToPixels`.
    """
    is_wxType = isinstance(dlg_unit, (wx.Size, wx.Point))
    pix = self.ConvertDialogToPixels(dlg_unit)
    if not is_wxType:
        pix = tuple(pix)
    return pix

def DestroyLater(

self)

Schedules the window to be destroyed in the near future.

This should be used whenever Destroy could happen too soon, such as when there may still be events for this window or its children waiting in the event queue.

def _Window_DestroyLater(self):
    """
    Schedules the window to be destroyed in the near future.
    
    This should be used whenever Destroy could happen too soon, such
    as when there may still be events for this window or its children
    waiting in the event queue.
    """
    self.Hide()
    wx.GetApp().ScheduleForDestruction(self)

def GetPositionTuple(

*args, **kw)

def deprecated_func(*args, **kw):
    warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                  wxPyDeprecationWarning, stacklevel=2)
    if not kw:
        return item(*args)
    return item(*args, **kw)

def GetSizeTuple(

*args, **kw)

def deprecated_func(*args, **kw):
    warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                  wxPyDeprecationWarning, stacklevel=2)
    if not kw:
        return item(*args)
    return item(*args, **kw)

def GetVirtualSizeTuple(

*args, **kw)

def deprecated_func(*args, **kw):
    warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                  wxPyDeprecationWarning, stacklevel=2)
    if not kw:
        return item(*args)
    return item(*args, **kw)

def MoveXY(

*args, **kw)

def deprecated_func(*args, **kw):
    warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                  wxPyDeprecationWarning, stacklevel=2)
    if not kw:
        return item(*args)
    return item(*args, **kw)

def OnAskButtonButton(

self, event)

def OnAskButtonButton(self, event):
    input=self.TextInput.GetValue()
    output=self.active_instrument.query(input)
    self.ResponseText.SetValue(output)
    event.Skip()

def OnInstrumentChoiceChoice(

self, event)

def OnInstrumentChoiceChoice(self, event):
    
    address=self.InstrumentChoice.GetStringSelection()
    #print address
    self.active_instrument=self.resource_manager.open_resource(address)
    event.Skip()

def OnReadButtonButton(

self, event)

def OnReadButtonButton(self, event):
    text=self.active_instrument.read()
    self.ResponseText.SetValue(text)
    event.Skip()

def OnWriteButtonButton(

self, event)

def OnWriteButtonButton(self, event):
    self.active_instrument.write(self.TextInput.GetValue())
    event.Skip()

def PostCreate(

*args, **kw)

def deprecated_func(*args, **kw):
    warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                  wxPyDeprecationWarning, stacklevel=2)
    if not kw:
        return item(*args)
    return item(*args, **kw)

def SetClientRect(

self, rect)

def _Window_SetClientRect(self, rect):
    return self.SetClientSize(rect)

def SetDimensions(

*args, **kw)

SetDimensions(x, y, width, height, sizeFlags=SIZE_AUTO)

def deprecated_func(*args, **kw):
    warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                  wxPyDeprecationWarning, stacklevel=2)
    if not kw:
        return item(*args)
    return item(*args, **kw)

def SetRect(

self, rect)

def _Window_SetRect(self, rect):
    return self.SetSize(rect)

def SetSizeHintsSz(

*args, **kw)

def deprecated_func(*args, **kw):
    warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                  wxPyDeprecationWarning, stacklevel=2)
    if not kw:
        return item(*args)
    return item(*args, **kw)

def SetSizeWH(

*args, **kw)

def deprecated_func(*args, **kw):
    warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                  wxPyDeprecationWarning, stacklevel=2)
    if not kw:
        return item(*args)
    return item(*args, **kw)

def SetToolTipString(

*args, **kw)

def deprecated_func(*args, **kw):
    warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                  wxPyDeprecationWarning, stacklevel=2)
    if not kw:
        return item(*args)
    return item(*args, **kw)

def SetVirtualSizeWH(

*args, **kw)

def deprecated_func(*args, **kw):
    warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                  wxPyDeprecationWarning, stacklevel=2)
    if not kw:
        return item(*args)
    return item(*args, **kw)

def Unbind(

self, event, source=None, id=-1, id2=-1, handler=None)

Disconnects the event handler binding for event from self. Returns True if successful.

def _EvtHandler_Unbind(self, event, source=None, id=wx.ID_ANY, id2=wx.ID_ANY, handler=None):
    """
    Disconnects the event handler binding for event from `self`.
    Returns ``True`` if successful.
    """
    if source is not None:
        id  = source.GetId()
    return event.Unbind(self, id, id2, handler)

Instance variables

var AcceleratorTable

GetAcceleratorTable() -> AcceleratorTable

Gets the accelerator table for this window.

var AffirmativeId

GetAffirmativeId() -> int

Gets the identifier of the button which works like standard OK button in this dialog.

var AutoLayout

GetAutoLayout() -> bool

Returns the sizer of which this window is a member, if any, otherwise NULL.

var BackgroundColour

GetBackgroundColour() -> Colour

Returns the background colour of the window.

var BackgroundStyle

GetBackgroundStyle() -> BackgroundStyle

Returns the background style of the window.

var BestSize

GetBestSize() -> Size

This functions returns the best acceptable minimal size for the window.

var BestVirtualSize

GetBestVirtualSize() -> Size

Return the largest of ClientSize and BestSize (as determined by a sizer, interior children, or other means)

var Border

GetBorder(flags) -> Border GetBorder() -> Border

Get the window border style from the given flags: this is different from simply doing flags & wxBORDER_MASK because it uses GetDefaultBorder() to translate wxBORDER_DEFAULT to something reasonable.

var Caret

GetCaret() -> Caret

Returns the caret() associated with the window.

var CharHeight

GetCharHeight() -> int

Returns the character height for this window.

var CharWidth

GetCharWidth() -> int

Returns the average character width for this window.

var Children

GetChildren() -> WindowList

Returns a reference to the list of the window's children.

var ClassInfo

GetClassInfo() -> ClassInfo

This virtual function is redefined for every class that requires run- time type information, when using the wxDECLARE_CLASS macro (or similar).

var ClassName

GetClassName() -> Char

Returns the class name of the C++ class using wxRTTI.

var ClientAreaOrigin

GetClientAreaOrigin() -> Point

Get the origin of the client area of the window relative to the window top left corner (the client area may be shifted because of the borders, scrollbars, other decorations...)

var ClientRect

GetClientRect() -> Rect

Get the client rectangle in window (i.e. client) coordinates.

var ClientSize

GetClientSize() -> Size

Returns the size of the window 'client area' in pixels.

var Constraints

GetConstraints() -> LayoutConstraints

Returns a pointer to the window's layout constraints, or NULL if there are none.

var ContainingSizer

GetContainingSizer() -> Sizer

Returns the sizer of which this window is a member, if any, otherwise NULL.

var ContentWindow

GetContentWindow() -> Window

Override this to return a window containing the main content of the dialog.

var Cursor

GetCursor() -> Cursor

Return the cursor associated with this window.

var DefaultAttributes

GetDefaultAttributes() -> VisualAttributes

Currently this is the same as calling wxWindow::GetClassDefaultAttributes(wxWindow::GetWindowVariant()).

var DefaultItem

GetDefaultItem() -> Window

Returns a pointer to the button which is the default for this window, or NULL.

var DropTarget

GetDropTarget() -> DropTarget

Returns the associated drop target, which may be NULL.

var EffectiveMinSize

GetEffectiveMinSize() -> Size

Merges the window's best size into the min size and returns the result.

var Enabled

IsEnabled() -> bool

Returns true if the window is enabled, i.e. if it accepts user input, false otherwise.

var EscapeId

GetEscapeId() -> int

Gets the identifier of the button to map presses of ESC button to.

var EventHandler

GetEventHandler() -> EvtHandler

Returns the event handler for this window.

var EvtHandlerEnabled

GetEvtHandlerEnabled() -> bool

Returns true if the event handler is enabled, false otherwise.

var ExtraStyle

GetExtraStyle() -> long

Returns the extra style bits for the window.

var Font

GetFont() -> Font

Returns the font for this window.

var ForegroundColour

GetForegroundColour() -> Colour

Returns the foreground colour of the window.

var GrandParent

GetGrandParent() -> Window

Returns the grandparent of a window, or NULL if there isn't one.

var Handle

GetHandle() -> UIntPtr

Returns the platform-specific handle of the physical window.

var HelpText

GetHelpText() -> String

Gets the help text to be used as context-sensitive help for this window.

var Icon

GetIcon() -> Icon

Returns the standard icon of the window.

var Id

GetId() -> WindowID

Returns the identifier of the window.

var Label

GetLabel() -> String

Generic way of getting a label from any window, for identification purposes.

var LayoutAdaptationDone

GetLayoutAdaptationDone() -> bool

Returns true if the dialog has been adapted, usually by making it scrollable to work with a small display.

var LayoutAdaptationLevel

GetLayoutAdaptationLevel() -> int

Gets a value representing the aggressiveness of search for buttons and sizers to be in the non-scrolling part of a layout-adapted dialog.

var LayoutAdaptationMode

GetLayoutAdaptationMode() -> DialogLayoutAdaptationMode

Gets the adaptation mode, overriding the global adaptation flag.

var LayoutDirection

GetLayoutDirection() -> LayoutDirection

Returns the layout direction for this window, Note that wxLayout_Default is returned if layout direction is not supported.

var MacMetalAppearance

MacGetMetalAppearance() -> bool

var MainButtonIds

GetMainButtonIds() -> ArrayInt

Returns an array of identifiers to be regarded as the main buttons for the non-scrolling area of a dialog.

var MaxClientSize

GetMaxClientSize() -> Size

Returns the maximum size of window's client area.

var MaxHeight

GetMaxHeight() -> int

Returns the vertical component of window maximal size.

var MaxSize

GetMaxSize() -> Size

Returns the maximum size of the window.

var MaxWidth

GetMaxWidth() -> int

Returns the horizontal component of window maximal size.

var MinClientSize

GetMinClientSize() -> Size

Returns the minimum size of window's client area, an indication to the sizer layout mechanism that this is the minimum required size of its client area.

var MinHeight

GetMinHeight() -> int

Returns the vertical component of window minimal size.

var MinSize

GetMinSize() -> Size

Returns the minimum size of the window, an indication to the sizer layout mechanism that this is the minimum required size.

var MinWidth

GetMinWidth() -> int

Returns the horizontal component of window minimal size.

var Name

GetName() -> String

Returns the window's name.

var NextHandler

GetNextHandler() -> EvtHandler

Returns the pointer to the next handler in the chain.

var OSXModified

OSXIsModified() -> bool

Returns the current modified state of the wxTopLevelWindow on OS X.

var Parent

GetParent() -> Window

Returns the parent of the window, or NULL if there is no parent.

var Position

GetPosition() -> Point

This gets the position of the window in pixels, relative to the parent window for the child windows or relative to the display origin for the top level windows.

var PreviousHandler

GetPreviousHandler() -> EvtHandler

Returns the pointer to the previous handler in the chain.

var Rect

GetRect() -> Rect

Returns the position and size of the window as a wxRect object.

var RefData

GetRefData() -> ObjectRefData

Returns the wxObject::m_refData pointer, i.e. the data referenced by this object.

var ReturnCode

GetReturnCode() -> int

Gets the return code for this window.

var ScreenPosition

GetScreenPosition() -> Point

Returns the window position in screen coordinates, whether the window is a child window or a top level one.

var ScreenRect

GetScreenRect() -> Rect

Returns the position and size of the window on the screen as a wxRect object.

var Shown

IsShown() -> bool

Returns true if the window is shown, false if it has been hidden.

var Size

GetSize() -> Size

Returns the size of the entire window in pixels, including title bar, border, scrollbars, etc.

var Sizer

GetSizer() -> Sizer

Returns the sizer associated with the window by a previous call to SetSizer(), or NULL.

var ThemeEnabled

GetThemeEnabled() -> bool

Clears the window by filling it with the current background colour.

var Title

GetTitle() -> String

Gets a string containing the window title.

var TmpDefaultItem

GetTmpDefaultItem() -> Window

var ToolTip

GetToolTip() -> ToolTip

Get the associated tooltip or NULL if none.

var TopLevel

IsTopLevel() -> bool

Returns true if the given window is a top-level one.

var TopLevelParent

GetTopLevelParent() -> Window

Returns the first ancestor of this window which is a top-level window.

var UpdateClientRect

GetUpdateClientRect() -> Rect

Get the update rectangle bounding box in client coords.

var UpdateRegion

GetUpdateRegion() -> Region

Returns the region specifying which parts of the window have been damaged.

var Validator

GetValidator() -> Validator

Validator functions.

var VirtualSize

GetVirtualSize() -> Size

This gets the virtual size of the window in pixels.

var WindowStyle

GetWindowStyle() -> long

See GetWindowStyleFlag() for more info.

var WindowStyleFlag

GetWindowStyleFlag() -> long

Gets the window style that was passed to the constructor or Create() method.

var WindowVariant

GetWindowVariant() -> WindowVariant

Returns the value previously passed to SetWindowVariant().

var instrument_list

var resource_manager

Module variables

var wxID_VISADIALOG

var wxID_VISADIALOGASKBUTTON

var wxID_VISADIALOGCOMMANDPANEL

var wxID_VISADIALOGINPUTLABEL

var wxID_VISADIALOGINSTRUMENTCHOICE

var wxID_VISADIALOGINSTRUMENTCHOOSERPANEL

var wxID_VISADIALOGINSTRUMENTLABEL

var wxID_VISADIALOGREADBUTTON

var wxID_VISADIALOGRESPONSELABEL

var wxID_VISADIALOGRESPONSETEXT

var wxID_VISADIALOGTEXTINPUT

var wxID_VISADIALOGTEXTPANEL

var wxID_VISADIALOGWRITEBUTTON