Ignore:
Timestamp:
Sep 2, 2021 4:10:06 PM (8 weeks ago)
Author:
toby
Message:

index changes for CCTBX; new scrolled output routine; document external routines

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIctrlGUI.py

    r4997 r5020  
    8282                                   used in Bind elsewhere in the code.
    8383:func:`G2MessageBox`               Displays text typically used for errors or warnings.
     84:func:`ShowScrolledInfo`           Displays longer text where scrolling is possibly needed
    8485:func:`GetItemOrder`               Creates a dialog for ordering items into columns
    8586:func:`GetImportFile`              Gets one ore more file from the appropriate import
     
    24122413    dlg.ShowModal()
    24132414    dlg.Destroy()
     2415
     2416def ShowScrolledInfo(parent,txt,width=600,height=400,header='Warning info'):
     2417    '''Simple code to display possibly extensive error or warning text
     2418    in a scrolled window.
     2419
     2420    :param wx.Frame parent: parent window for
     2421    :param str txt: text to be displayed
     2422    :param int width: lateral of window in pixels (defaults to 600)
     2423    :param int height: vertical dimension of window in pixels (defaults to 400)
     2424    :param str header: width of window in pixels (defaults to 600)
     2425    '''
    24142426   
     2427    dlg = wx.Dialog(parent.GetTopLevelParent(),wx.ID_ANY,header, style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER)
     2428    spanel = wxscroll.ScrolledPanel(dlg, wx.ID_ANY, size=(width-20, height))
     2429    mainSizer = wx.BoxSizer(wx.VERTICAL)
     2430    mainSizer.Add(spanel,1,wx.ALL|wx.EXPAND,1)
     2431
     2432    txtSizer = wx.BoxSizer(wx.VERTICAL)
     2433    txt = wx.StaticText(spanel,wx.ID_ANY,txt)
     2434    txt.Wrap(600)
     2435    txt.SetBackgroundColour(wx.WHITE)
     2436    txtSizer.Add(txt,1,wx.ALL|wx.EXPAND,1)
     2437    spanel.SetSizer(txtSizer)
     2438    btnsizer = wx.BoxSizer(wx.HORIZONTAL)
     2439    btn = wx.Button(dlg, wx.ID_CLOSE)
     2440    btn.Bind(wx.EVT_BUTTON,lambda event: dlg.EndModal(wx.ID_CANCEL))
     2441    btnsizer.Add(btn)
     2442    mainSizer.Add(btnsizer, 0, wx.ALIGN_CENTER|wx.ALL, 5)
     2443    dlg.SetSizer(mainSizer)
     2444    mainSizer.Fit(dlg)
     2445    spanel.SetAutoLayout(1)
     2446    spanel.SetupScrolling()
     2447    #dlg.SetMaxSize((-1,400))
     2448    dlg.CenterOnParent()
     2449    dlg.ShowModal()
     2450    dlg.Destroy()
     2451
    24152452################################################################################
    24162453class PickTwoDialog(wx.Dialog):
Note: See TracChangeset for help on using the changeset viewer.