• R/O
  • SSH

tkpane: Commit

Default repository for tkpane.py.


Commit MetaInfo

Revisão4fa1db37dc3079cf95228e8371151e4ff5cd31e2 (tree)
Hora2018-03-15 03:44:05
Autoreshea
Commitereshea

Mensagem de Log

Modified RadiobuttonPane to add orientation option, with default of vertical (radio buttons stacked).

Mudança Sumário

Diff

diff -r d978bf2a4f2c -r 4fa1db37dc30 test/test_radiobutton.py
--- a/test/test_radiobutton.py Wed Mar 14 11:33:27 2018 -0700
+++ b/test/test_radiobutton.py Wed Mar 14 11:44:05 2018 -0700
@@ -59,7 +59,7 @@
5959 })
6060 tkpane.lib.current_panestyle = "closey"
6161 lo.build_elements({
62- "rb1": lambda p: tkpane.lib.RadiobuttonPane(p, "rb1", "Radiobutton1", [("Option1",1), ("Option2",2), ("Option3", 3)], "Option7")
62+ "rb1": lambda p: tkpane.lib.RadiobuttonPane(p, "rb1", "Radiobutton1", [("Option1",1), ("Option2",2), ("Option3", 3)], "Option1")
6363 })
6464
6565
@@ -69,7 +69,7 @@
6969 entry2 = lo.pane("entry2")
7070 text_pane = lo.pane("text_pane")
7171 rb1 = lo.pane("rb1")
72-rb1.required = True
72+#rb1.required = True
7373 button1 = lo.pane("button1")
7474 button2 = lo.pane("button2")
7575
diff -r d978bf2a4f2c -r 4fa1db37dc30 tkpane/lib.py
--- a/tkpane/lib.py Wed Mar 14 11:33:27 2018 -0700
+++ b/tkpane/lib.py Wed Mar 14 11:44:05 2018 -0700
@@ -1682,7 +1682,10 @@
16821682 :param pane_name: The name to be used to identify this pane in status messages.
16831683 :param prompt: The text associated with the set of radiobuttons.
16841684 :param option_list: List of radiobutton options, consisting of tuples in the format: (label, value).
1685- :param default_option: The label of the default option, e.g., "radioopt1" for ("radioopt", 1)
1685+ :param default_option: The label of the default option, e.g., "radioopt1" for ("radioopt", 1). If the default
1686+ option is not actually present on the option list (or if no default option is specified), the default value is
1687+ set to the empty string "".
1688+ :param orient_vertical: Whether the radio button group should be oriented horizontally or vertically. Default is True (vertical)
16861689 :param button_action: A callback to perform an action when a value is selected.
16871690 :param key_name: The name to be used with the internal data dictionary to identify the entry data; use to avoid name conflicts with other RadiobuttonPane panes on the same UI (optional).
16881691 :param config_opts: A dictionary of configuration options for the Radiobutton widget
@@ -1710,7 +1713,7 @@
17101713
17111714 """
17121715
1713- def __init__(self, parent, pane_name, prompt, option_list, default_option=None, button_action=None, key_name=None, config_opts=None):
1716+ def __init__(self, parent, pane_name, prompt, option_list, default_option=None, orient_vertical=True, button_action=None, key_name=None, config_opts=None):
17141717 def do_nothing(data_dict):
17151718 pass
17161719 tkpane.TkPane.__init__(self, parent, pane_name, frame_config_opts(), frame_grid_opts())
@@ -1740,8 +1743,12 @@
17401743 self.widget_type = "tk"
17411744 if config_opts is not None:
17421745 self.radio_btn.configure(**config_opts)
1743- radio_btn.grid(row=0, column=i+1, padx=3, pady=3, sticky=tk.EW)
1744- self.columnconfigure(i+1, weight=1)
1746+ if orient_vertical:
1747+ radio_btn.grid(row=i, column=1, padx=3, pady=3, sticky=tk.EW)
1748+ self.rowconfigure(i, weight=1)
1749+ else:
1750+ radio_btn.grid(row=0, column=i+1, padx=3, pady=3, sticky=tk.EW)
1751+ self.columnconfigure(i+1, weight=1)
17451752 self.rowconfigure(0, weight=0)
17461753 parent.rowconfigure(0, weight=0)
17471754 parent.columnconfigure(0, weight=1)
Show on old repository browser