Dans_Diffraction.tkgui.basic_widgets
index
c:\users\grp66007\onedrive - diamond light source ltd\pythonprojects\dans_diffraction\dans_diffraction\tkgui\basic_widgets.py

Basic widgets and gui parameters

 
Modules
       
tkinter.filedialog
tkinter.messagebox
re
sys
tkinter

 
Classes
       
builtins.object
SelectionBox
StringViewer

 
class SelectionBox(builtins.object)
    SelectionBox(parent, data_fields, current_selection=(), title='Make a selection', multiselect=True)
 
Displays all data fields and returns a selection
Making a selection returns a list of field strings
 
out = SelectionBox(['field1','field2','field3'], current_selection=['field2'], title='', multiselect=False).show()
# Make selection and press "Select" > box disappears
out = ['list','of','strings']
 
  Methods defined here:
__init__(self, parent, data_fields, current_selection=(), title='Make a selection', multiselect=True)
Initialize self.  See help(type(self)) for accurate signature.
f_exit(self, event=None)
Closes the current data window
fun_exitbutton(self, event=None)
Closes the current data window and generates output
fun_listboxselect(self, event=None)
Update label on listbox selection
fun_search(self, event=None)
Search the selection for string
show(self)
Run the selection box, wait for response

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class StringViewer(builtins.object)
    StringViewer(string, title='', width=40)
 
Simple GUI that displays strings
    StringViewer(string, title, width)
 
  Methods defined here:
__init__(self, string, title='', width=40)
Initialise
fun_close(self)
close window
fun_saveas(self)
Save as text file
fun_search(self, event=None)
Search

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Functions
       
dark_mode()
Change the colour scheme
light_mode()
Change the colour scheme
menu_docs()
Open local docs
menu_github()
Open GitHub page
popup_about()
Create about message
popup_help()
Create help message
popup_message(parent, title, message)
Create a message box
search_re(pattern, text)
text_search(text: tkinter.Text, search_pattern: str, highlight_colour='yellow')
Find string patterns in tk Text object and highlight them
:param text: tk.Text object
:param search_pattern: str text to search for or Regular expression
:param highlight_colour: str color spec
:return: None
topmenu(root, menu_dict)
Add a menubar to tkinter frame
:param root: tkinter root
:param menu_dict: {Menu name: {Item name: function}}
:return: None

 
Data
        BF = ['Palatino', 14]
HF = ['Courier', 12]
LF = ['Palatino', 14]
MF = ['Courier', 8]
SF = ['Palatino', 14]
TF = ['Palatino', 12]
TTBG = 'light grey'
TTF = ('Helvetica', 10, 'bold italic')
TTFG = 'red'
bkg = 'snow'
btn = 'azure'
btn2 = 'gold'
btn_active = 'grey'
btn_txt = 'black'
ety = 'white'
ety_txt = 'black'
opt = 'azure'
opt_active = 'grey'
opt_txt = 'black'
txtcol = 'black'