瀏覽代碼

*** empty log message ***

Joe Shochet 24 年之前
父節點
當前提交
993b4582ad
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. 9 0
      direct/src/gui/DirectEntry.py

+ 9 - 0
direct/src/gui/DirectEntry.py

@@ -40,6 +40,7 @@ class DirectEntry(DirectFrame):
             ('extraArgs',      [],                None),
             ('extraArgs',      [],                None),
             # Sounds to be used for button events
             # Sounds to be used for button events
             ('rolloverSound',   getDefaultRolloverSound(), self.setRolloverSound),
             ('rolloverSound',   getDefaultRolloverSound(), self.setRolloverSound),
+            ('clickSound',    getDefaultClickSound(),    self.setClickSound),
             )
             )
         # Merge keyword options with default options
         # Merge keyword options with default options
         self.defineoptions(kw, optiondefs)
         self.defineoptions(kw, optiondefs)
@@ -105,6 +106,14 @@ class DirectEntry(DirectFrame):
             else:
             else:
                 self.guiItem.clearSound(ENTER + self.guiId)
                 self.guiItem.clearSound(ENTER + self.guiId)
 
 
+    def setClickSound(self):
+        if base.wantSfx:
+            clickSound = self['clickSound']
+            if clickSound:
+                self.guiItem.setSound(ACCEPT + self.guiId, clickSound)
+            else:
+                self.guiItem.clearSound(ACCEPT + self.guiId)
+
     def commandFunc(self, event):
     def commandFunc(self, event):
         if self['command']:
         if self['command']:
             # Pass any extra args to command
             # Pass any extra args to command