campy.private.backends.tk.backend_tk module

We match the Tk hierarchy of classes onto the ACM hierarchy as follows: Each application (i.e. instance of TkBackend) has exactly one Tk root (i.e. one tkinter.Tk()).

This top widget takes care of everything.

After instantiation of the first instance of a TkBackend, the tkinter._default_root will be set.

Except in extreme circumstances, there should only ever be one instance of TkBackend.

Each GWindow is associated to a single Canvas. GWindows beyond the first will open a new Toplevel window.

## EXIT BEHAVIOR (A) At program termination, Tk object is not destroyed, and “program” isn’t done until Tk window is closed. (B) At program termination, Tk object is destroyed and program is finished.

class campy.private.backends.tk.backend_tk.TkBackend[source]

Bases: campy.private.backends.backend_base.GraphicsBackendBase

event_add_keypress_handler(event, handler)[source]
event_add_mouse_handler(event, handler)[source]
event_add_window_changed_handler(handler)[source]
event_generate_keypress(event)[source]
event_generate_mouse(event)[source]
event_pump_one()[source]
event_set_window_closed_handler(handler)[source]
g3drect_constructor(gobject, width, height, raised)[source]
g3drect_set_raised(gobject, raised)[source]
garc_constructor(garc)[source]
garc_set_frame_rectangle(garc, x, y, width, height)[source]
garc_set_start_angle(garc, angle)[source]
garc_set_sweep_angle(garc, angle)[source]
gbutton_constructor(gbutton)[source]
gbutton_set_disabled(gbutton)[source]
gbutton_set_label(gbutton)[source]
gcheckbox_constructor(gcheckbox)[source]
gcheckbox_is_selected(gcheckbox)[source]
gcheckbox_set_selected(gcheckbox, state)[source]
gchooser_add_item(gchooser, item)[source]
gchooser_constructor(gchooser)[source]
gchooser_get_selected_item(gchooser)[source]
gchooser_set_selected_item(gchooser, item)[source]
gcompound_add(compound, gobject)[source]
gcompound_constructor(gobject)[source]
get_next_event(mask)[source]
gfilechooser_show_open_dialog(current_dir, file_filter)[source]
gfilechooser_show_save_dialog(current_dir, file_filter)[source]
gfont_attributes_from_system_name(font_name)[source]
gfont_default_attributes()[source]
gfont_get_font_metrics(gfont)[source]
gfont_measure_text_width(gfont, text)[source]
gimage_blank(gimage, width, height)[source]
gimage_constructor(gimage)[source]

Try to create some sort of Tk Photo Image.

gimage_get_pixel(gimage, row, col)[source]
gimage_preview(gimage)[source]
gimage_set_pixel(gimage, row, col, rgb)[source]
glabel_constructor(glabel)[source]
glabel_get_font_ascent(glabel)[source]
glabel_get_font_descent(glabel)[source]
glabel_get_size(glabel)[source]
glabel_set_font(glabel, gfont)[source]
glabel_set_label(glabel, text)[source]
gline_constructor(gline)[source]
gline_set_end_point(gline, x, y)[source]
gline_set_start_point(gline, x, y)[source]
gobject_contains(gobject, x, y)[source]
gobject_get_bounds(gobject)[source]
gobject_get_size(gobject)[source]
gobject_remove(gobject)[source]
gobject_rotate(gobject, theta)[source]
gobject_scale(gobject, sx, sy)[source]
gobject_send_backward(gobject)[source]
gobject_send_forward(gobject)[source]
gobject_send_to_back(gobject)[source]
gobject_send_to_front(gobject)[source]
gobject_set_color(gobject, color)[source]
gobject_set_fill_color(gobject, color)[source]
gobject_set_filled(gobject, flag)[source]
gobject_set_line_width(gobject, line_width)[source]
gobject_set_location(gobject, x, y)[source]
gobject_set_size(gobject, width, height)[source]
gobject_set_visible(gobject, flag)[source]
goptionpane_show_confirm_dialog(message, title, confirm_type)[source]
goptionpane_show_input_dialog(message, title)[source]
goptionpane_show_message_dialog(message, title, message_type)[source]
goptionpane_show_option_dialog(message, title, options, initially_selected)[source]
goptionpane_show_text_file_dialog(message, title, rows, cols)[source]
goval_constructor(goval)[source]
gpolygon_add_vertex(gpolygon, x, y)[source]
gpolygon_constructor(gpolygon)[source]
grect_constructor(grect)[source]
groundrect_constructor(gobject, width, height, corner)[source]
gslider_constructor(gslider, min, max, value)[source]
gslider_get_value(gslider)[source]
gslider_set_value(gslider, value)[source]
gtextfield_constructor(gtextfield, num_chars)[source]
gtextfield_get_text(gtextfield)[source]
gtextfield_set_text(gtextfield, str)[source]
gwindow_add_to_region(gwindow, gobject, region)[source]
gwindow_clear(gwindow)[source]
gwindow_clear_canvas(gwindow)[source]
gwindow_close(gwindow)[source]
gwindow_constructor(gwindow, width, height, top_compound, visible=True)[source]
gwindow_delete(gwindow)[source]
gwindow_draw(gwindow, gobject)[source]
gwindow_exit_graphics()[source]
gwindow_get_height()[source]
gwindow_get_width()[source]
gwindow_remove_from_region(gwindow, gobject, region)[source]
gwindow_repaint(gwindow)[source]
gwindow_request_focus(gwindow)[source]
gwindow_set_exit_on_close(gwindow, exit_on_close)[source]
gwindow_set_region_alignment(gwindow, region, align)[source]
gwindow_set_visible(gwindow, flag)[source]
gwindow_set_window_title(gwindow, title)[source]
image_find(filename)[source]
image_load(filename)[source]
set_action_command(gobject, cmd)[source]
timer_pause(event)[source]
timer_schedule(function, delay_ms)[source]
wait_for_event(mask)[source]
class campy.private.backends.tk.backend_tk.TkWindow(root, width, height, parent)[source]

Bases: object

The Tk equivalent to a GWindow.

bottom

Get the bottom bar for interactors, creating it if needed.

canvas
clear()[source]
clear_canvas()[source]
left

Get the left bar for interactors, creating it if needed.

right

Get the right bar for interactors, creating it if needed.

top

Get the top bar for interactors, creating it if needed.