code: def show_warning(title, message, get_preference, set_preference):
      """Show a silenceable warning message to the user
  
      title - title for the dialog box
  
      message - message to be displayed
  
      get_preference - function that gets a user preference: do you want to
                       show this warning?
  
      set_preference - function that sets the user preference if they choose
                       not to see the warning again.
  
      The message is printed to the console if headless.
      """
  
      if get_headless():
          print(message)
          return
  
      if not get_preference():
          return
  
      import wx
  
      if wx.GetApp() is None:
          print(message)
          return
  
      with wx.Dialog(None, title=title) as dlg:
          dlg.Sizer = sizer = wx.BoxSizer(wx.VERTICAL)
          subsizer = wx.BoxSizer(wx.HORIZONTAL)
          sizer.Add(subsizer, 0, wx.EXPAND | wx.ALL, 5)
          subsizer.Add(
              wx.StaticBitmap(
                  dlg,
                  wx.ID_ANY,
                  wx.ArtProvider.GetBitmap(
                      wx.ART_INFORMATION, wx.ART_CMN_DIALOG
                  ),
              ),
              0,
              wx.ALIGN_LEFT | wx.ALIGN_TOP | wx.RIGHT,
              5,
          )
          text = wx.StaticText(dlg, wx.ID_ANY, message)
          subsizer.Add(
              text, 0, wx.ALIGN_LEFT | wx.ALIGN_TOP | wx.ALL, 5
          )
          dont_show = wx.CheckBox(
              dlg, label="Don't show this message again."
          )
          sizer.Add(dont_show, 0, wx.ALIGN_LEFT | wx.ALL, 5)
          buttons_sizer = wx.StdDialogButtonSizer()
          buttons_sizer.AddButton(wx.Button(dlg, wx.ID_OK))
          buttons_sizer.Realize()
          sizer.Add(
              buttons_sizer, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5
          )
          dlg.Fit()
          dlg.ShowModal()
          if dont_show.GetValue():
              set_preference(False)
  
file_path: CellProfiler/src/frontend/cellprofiler/gui/errordialog.py
imports: import functools
  import io
  import logging
  import os
  import platform
  import sys
  import traceback
  import urllib
  import urllib.parse
  import urllib.request
  from urllib.error import HTTPError, URLError
  from urllib.request import urlopen
  from cellprofiler_core.preferences import get_headless
label_desc: Use image node_id 5 for calling a global function with example usage: show_warning(title, message, get_preference, set_preference) without return types