Browse Source

Made tk window not create if it is not wanted

Gyedo Jeon 16 years ago
parent
commit
b884ec3ea3
1 changed files with 12 additions and 6 deletions
  1. 12 6
      direct/src/directtools/DirectSession.py

+ 12 - 6
direct/src/directtools/DirectSession.py

@@ -18,9 +18,9 @@ from DirectGrid import DirectGrid
 from DirectLights import DirectLights
 from direct.cluster.ClusterClient import createClusterClient, DummyClusterClient
 from direct.cluster.ClusterServer import ClusterServer
-from direct.tkpanels import Placer
-from direct.tkwidgets import Slider
-from direct.tkwidgets import SceneGraphExplorer
+## from direct.tkpanels import Placer
+## from direct.tkwidgets import Slider
+## from direct.tkwidgets import SceneGraphExplorer
 from direct.gui import OnscreenText
 from direct.showbase import Loader
 
@@ -152,12 +152,18 @@ class DirectSession(DirectObject):
             ['SGE_Toggle Vis', self.toggleVis],
             ['SGE_Show All', self.showAllDescendants],
             ['SGE_Fit', self.fitOnNodePath],
-            ['SGE_Place', Placer.place],
-            ['SGE_Set Color', Slider.rgbPanel],
-            ['SGE_Explore', SceneGraphExplorer.explore],
             ['SGE_Delete', self.removeNodePath],
             ['SGE_Set Name', self.getAndSetName],
             ]
+
+        if base.wantTk:
+            from direct.tkpanels import Placer
+            from direct.tkwidgets import Slider
+            from direct.tkwidgets import SceneGraphExplorer            
+            self.actionEvents.extend([
+            ['SGE_Place', Placer.place],
+            ['SGE_Set Color', Slider.rgbPanel],
+            ['SGE_Explore', SceneGraphExplorer.explore],])
         self.modifierEvents = ['control', 'control-up',
                               'shift', 'shift-up',
                               'alt', 'alt-up',