久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<small id='tb8pC'></small><noframes id='tb8pC'>

    1. <tfoot id='tb8pC'></tfoot>
      <legend id='tb8pC'><style id='tb8pC'><dir id='tb8pC'><q id='tb8pC'></q></dir></style></legend>
        <i id='tb8pC'><tr id='tb8pC'><dt id='tb8pC'><q id='tb8pC'><span id='tb8pC'><b id='tb8pC'><form id='tb8pC'><ins id='tb8pC'></ins><ul id='tb8pC'></ul><sub id='tb8pC'></sub></form><legend id='tb8pC'></legend><bdo id='tb8pC'><pre id='tb8pC'><center id='tb8pC'></center></pre></bdo></b><th id='tb8pC'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='tb8pC'><tfoot id='tb8pC'></tfoot><dl id='tb8pC'><fieldset id='tb8pC'></fieldset></dl></div>

          <bdo id='tb8pC'></bdo><ul id='tb8pC'></ul>

        獲取調用事件的按鈕名稱的最佳方法?

        Best way to get the name of a button that called an event?(獲取調用事件的按鈕名稱的最佳方法?)

          <tbody id='GRHoI'></tbody>

            <tfoot id='GRHoI'></tfoot>
            <legend id='GRHoI'><style id='GRHoI'><dir id='GRHoI'><q id='GRHoI'></q></dir></style></legend>

            <small id='GRHoI'></small><noframes id='GRHoI'>

              <i id='GRHoI'><tr id='GRHoI'><dt id='GRHoI'><q id='GRHoI'><span id='GRHoI'><b id='GRHoI'><form id='GRHoI'><ins id='GRHoI'></ins><ul id='GRHoI'></ul><sub id='GRHoI'></sub></form><legend id='GRHoI'></legend><bdo id='GRHoI'><pre id='GRHoI'><center id='GRHoI'></center></pre></bdo></b><th id='GRHoI'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='GRHoI'><tfoot id='GRHoI'></tfoot><dl id='GRHoI'><fieldset id='GRHoI'></fieldset></dl></div>

              • <bdo id='GRHoI'></bdo><ul id='GRHoI'></ul>

                  本文介紹了獲取調用事件的按鈕名稱的最佳方法?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  在以下代碼中(受 this 片段的啟發),我使用了一個事件處理程序 buttonClick 以更改窗口的標題.目前,我需要評估事件的 Id 是否對應于按鈕的 Id.如果我決定添加 50 個按鈕而不是 2 個,這種方法可能會變得很麻煩.有沒有更好的方法來做到這一點?

                  In the following code (inspired by this snippet), I use a single event handler buttonClick to change the title of the window. Currently, I need to evaluate if the Id of the event corresponds to the Id of the button. If I decide to add 50 buttons instead of 2, this method could become cumbersome. Is there a better way to do this?

                  import wx
                  
                  class MyFrame(wx.Frame):
                      def __init__(self):
                          wx.Frame.__init__(self, None, wx.ID_ANY, 'wxBitmapButton',
                              pos=(300, 150), size=(300, 350))
                          self.panel1 = wx.Panel(self, -1)
                  
                          self.button1 = wx.Button(self.panel1, id=-1,
                              pos=(10, 20), size = (20,20))
                          self.button1.Bind(wx.EVT_BUTTON, self.buttonClick)
                  
                          self.button2 = wx.Button(self.panel1, id=-1,
                              pos=(40, 20), size = (20,20))
                          self.button2.Bind(wx.EVT_BUTTON, self.buttonClick)
                  
                          self.Show(True)
                  
                      def buttonClick(self,event):
                          if event.Id == self.button1.Id:
                              self.SetTitle("Button 1 clicked")
                          elif event.Id == self.button2.Id:
                              self.SetTitle("Button 2 clicked")            
                  
                  application = wx.PySimpleApp()
                  window = MyFrame()
                  application.MainLoop()
                  

                  推薦答案

                  你可以給按鈕一個名字,然后在事件處理程序中查看這個名字.

                  You could give the button a name, and then look at the name in the event handler.

                  當你制作按鈕時

                  b = wx.Button(self, 10, "Default Button", (20, 20))
                  b.myname = "default button"
                  self.Bind(wx.EVT_BUTTON, self.OnClick, b)
                  

                  當按鈕被點擊時:

                  def OnClick(self, event):
                      name = event.GetEventObject().myname
                  

                  這篇關于獲取調用事件的按鈕名稱的最佳方法?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to make a discord bot that gives roles in Python?(如何制作一個在 Python 中提供角色的不和諧機器人?)
                  Discord bot isn#39;t responding to commands(Discord 機器人沒有響應命令)
                  Can you Get the quot;About mequot; feature on Discord bot#39;s? (Discord.py)(你能得到“關于我嗎?Discord 機器人的功能?(不和諧.py))
                  message.channel.id Discord PY(message.channel.id Discord PY)
                  How do I host my discord.py bot on heroku?(如何在 heroku 上托管我的 discord.py 機器人?)
                  discord.py - Automaticaly Change an Role Color(discord.py - 自動更改角色顏色)
                1. <tfoot id='Ch56r'></tfoot>

                      <i id='Ch56r'><tr id='Ch56r'><dt id='Ch56r'><q id='Ch56r'><span id='Ch56r'><b id='Ch56r'><form id='Ch56r'><ins id='Ch56r'></ins><ul id='Ch56r'></ul><sub id='Ch56r'></sub></form><legend id='Ch56r'></legend><bdo id='Ch56r'><pre id='Ch56r'><center id='Ch56r'></center></pre></bdo></b><th id='Ch56r'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Ch56r'><tfoot id='Ch56r'></tfoot><dl id='Ch56r'><fieldset id='Ch56r'></fieldset></dl></div>
                        <tbody id='Ch56r'></tbody>

                      <legend id='Ch56r'><style id='Ch56r'><dir id='Ch56r'><q id='Ch56r'></q></dir></style></legend>
                      1. <small id='Ch56r'></small><noframes id='Ch56r'>

                            <bdo id='Ch56r'></bdo><ul id='Ch56r'></ul>
                            主站蜘蛛池模板: 欧美激情久久久 | 日本一区二区不卡 | 欧美天堂在线观看 | 日韩1区 | 波多野吉衣久久 | 午夜av成人| 色综合久 | 国产激情在线 | 日日夜夜精品 | 影视先锋av资源噜噜 | 欧美日韩在线高清 | 久久久久久久久中文字幕 | 在线午夜 | 国产精品国产精品国产专区不蜜 | 国产日韩欧美在线一区 | 欧美mv日韩mv国产网站91进入 | 中文字幕 国产 | 午夜精品久久久久久久久久久久 | 日本一区二区三区在线观看 | 久久久久久av| 一级片在线视频 | 精品欧美一区免费观看α√ | 蜜桃av人人夜夜澡人人爽 | 精品久久久久久久久久久久久久 | 成人影院在线 | 久久逼逼| 亚洲二区视频 | 欧美国产日韩在线 | 在线看免费 | 久草视频在线播放 | 国产草草视频 | 日韩黄色免费 | 欧美一区二区视频 | 久久首页 | 日韩精品一区二区三区中文在线 | av免费在线播放 | 久久精品手机视频 | 国产高清精品一区二区三区 | 免费看片国产 | 久色| 正在播放国产精品 |