多个选项菜单,如何保存值更改和追加列表?

时间:2019-01-31 14:54:45

标签: python-2.7 tkinter optionmenu

我对trace optionmenus值有问题,一开始我想补充一下我是python新手。如何基于tkinter选项菜单的当前选择来更新列表?我有多个基于IP的IP地址(在代码validIP中),我根据该次选择多次复制带有添加/删除选项的optionmenu,我有列表add_delete_list,但是在需要更改我的选择的情况下,它会在列表中添加下一个元素,但是尽管添加了新的我也想更改适当的一个。例如,我有2个IP(validIPs = 2),因此我得到2个OptionMenu单击,例如,首先选择Delete,然后第二个Delete,我得到lis ['Delete',''Delete'],当我想更改1 Delete to Add我得到了['Delete','Delete','Add']如何将其更改为['Add',''Delete']吗? 预先感谢!

<div class="module-wrapper">
  <table class="module-table">
    <tr>
      <td class="module">
        <div class="module-number one-one"><a href="#">1.1</a></div>
      </td>
      <td class="module">
        <div class="module-number one-two"><a href="#">1.2</a></div>
      </td>
      <td class="module">
        <div class="module-number one-three"><a href="#">1.3</a></div>
      </td>
    </tr>
    <tr>
      <td class="module">
        <div class="module-number one-four"><a href="#">1.4</a></div>
      </td>
      <td class="module">
        <div class="module-number one-five"><a href="#">1.5</a></div>
      </td>
      <td class="module">
        <div class="module-number one-six"><a href="#">1.6</a></div>
      </td>
    </tr>
    <tr>
      <td class="module">
        <div class="module-number one-seven"><a href="#">1.7</a></div>
      </td>
      <td class="module">
        <div class="module-number one-eight"><a href="#">1.8</a></div>
      </td>
      <td class="module">
        <div class="module-number one-nine"><a href="#">1.9</a></div>
      </td>
    </tr>
  </table>
</div>

0 个答案:

没有答案