Exemplo n.º 1
0
 def load_p_file():
     """load pickle file with Tk"""
     global graph
     graph = SHELL.open_p_file()
     SHELL.msgtxt.set(
         Cli.ul(graph.label.title(), width=SIZE*2+6) + str(graph))
     graph.sh_obj = SHELL
Exemplo n.º 2
0
def fill():
    """
    Call the graphs fill() method and refresh the text of the message
    widget.
    """
    graph.fill(graph.color_chooser())
    SHELL.msgtxt.set(Cli.ul(graph.label.title(), width=SIZE*2+6) + str(graph))
Exemplo n.º 3
0
 def add_polynomial():
     """
     Dispatches appropriate dialogs, then plots
     polynomial, adding it to the polynmial list.
     """
     graph.add_polynomial()
     SHELL.msgtxt.set(
         Cli.ul(graph.label.title(), width=SIZE*2+6) + str(graph))
Exemplo n.º 4
0
def new_graph():
    """
    Load JSON skinfile if specified and create a new goban instance
    """
    if ARGS is not None and ARGS.skin is not None:
        plane = Goban(sh_obj=SHELL, size=SIZE, skinfile=ARGS.skin)
    else: plane = Goban(size=SIZE, sh_obj=SHELL)
    SHELL.msgtxt.set(Cli.ul(plane.label.title(), width=SIZE*2+6) + str(plane))
    return plane
Exemplo n.º 5
0
 def plot_point():
     """
     Calls color-chooser dialog, and dialog prompts, then plots
     point.
     """
     color = graph.color_chooser()
     graph.prompt_point(color)
     SHELL.msgtxt.set(
         Cli.ul(graph.label.title(), width=SIZE*2+6) + str(graph))
Exemplo n.º 6
0
def _click_callback(event):
    """
    Feedback to click event, i.e., places a stone/plots a point at the
    spot clicked.
    """
    SHELL.main_window.focus_set()
    var1.set('clicked at {}, {}'.format(event.x, event.y))
    cartes_tuple = pixel2cartesian(event.x, event.y)
    color_ = graph.plane[cartes_tuple[0] + (graph.size // 2)][
        (graph.size // 2) - cartes_tuple[1]].marker
    if color_ == 'black':
        color_ = 'white'
    elif color_ == 'white':
        color_ = 'empty' # THE CLASS SEEMS TO TAKE CARE OF HOSHI, etc.
    elif color_ in ['empty', 'hoshi', 'x_axis', 'origin', 'y_axis']:
        color_ = 'black'
    graph.plot_point(*cartes_tuple, color=color_)
    SHELL.msgtxt.set(Cli.ul(graph.label.title(), width=SIZE*2+6) + str(graph))
Exemplo n.º 7
0
 def output(cls, msg, **kwargs):
     """Write text to the default message area"""
     if 'heading' in kwargs: 
         msg = Cli.ul(kwargs['heading'], symbol='-', width=20) + msg
     cls.msgtxt.set(msg)