-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
48 lines (38 loc) · 1.28 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from json import load
import pconsole
from panda3d.core import Filename, loadPrcFileData
from direct.showbase.ShowBase import ShowBase
from direct.gui.OnscreenImage import OnscreenImage
from threading import Thread
import os,sys
MAINDIR = Filename.from_os_specific(os.path.abspath(sys.path[0])).getFullpath()
loadPrcFileData('', 'undecorated 1')
loadPrcFileData('', 'win-size 1280 720')
class TestApp(ShowBase):
def __init__(self):
ShowBase.__init__(self)
self.set_background_color(0.1137, 0.1450, 0.1725)
self.disable_mouse()
self.mire = OnscreenImage(image = os.path.join(MAINDIR,'test.jpeg'))
self.mire.setScale(1.6, 1, 1)
self.mire.hide()
self.is_shown = False
command_dic = {
"toggleImage":self.toggleImage
}
self.commandline = pconsole.Console()
self.commandline.create(command_dic, app = self, event = 'f1')
self.task_mgr.add(self.update, "updatingTask")
def update(self, task):
return task.cont
def toggleImage(self):
if self.is_shown:
self.mire.hide()
else:
self.mire.show()
self.is_shown = not self.is_shown
def testfunc():
'''docstring goes here'''
pass
App = TestApp()
App.run()