
| Current Path : /home/ift/52_procpy/dataninja/test/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : //home/ift/52_procpy/dataninja/test/graphmodel.py |
# coding: utf8
import os,re,sys
import procpy
import procpy.graphmodel
try:
import tkinter
except:
pip.main(["install","tkinter"])
#**************************************************************************
class Graphmodel (object):
def __init__ (self,*pars):
self.__class__.__dict__[pars[0]](self,pars[1:])
#**************************************************************************
def test (self,*pars):
app = tkinter.Tk()
canvas = procpy.graphmodel.Graphmodel(
app,width=600,height=400)
# canvas = procpy.graphmodel.Graphmodel(
# app,width=600,height=400,
# del_event="<ESCAPE>",
# rearr_event="<....>")
canvas.pack()
app.mainloop()
#**************************************************************************
def ox (self,*pars):
app = tkinter.Tk()
canvas = procpy.graphmodel.Graphmodel(
app,width=600,height=400,
del_event="<ESCAPE>",
rearr_event="<....>")
canvas.pack()
app.mainloop()
#**************************************************************************
def init_class (self,*pars):
app = tkinter.Tk()
canvas = procpy.graphmodel.Graphmodel(app,width=600,height=400)
w = 70
h = 40
x = 100
y = 100
canvas.create_block(x,y,w,h)
x = 300
y = 100
canvas.create_block(x,y,w,h)
for block in canvas.blocks:
canvas.highlight_block(block)
canvas.create_arrow()
for block in canvas.blocks:
block.content.config(state=tkinter.NORMAL)
block.content.insert("1.0","time=5") # text can be inserted only in NORMAL mode!!!
block.content.config(state=tkinter.DISABLED)
classname = "Testq"
text = canvas.initiate_class(classname)
print(text)
exec(text)
testobj = Testq()
print(dir(testobj)) # all accessable functions of testobj
print(testobj.JUMP) # the JUMP defined in __init__
test1= "testobj."+str(testobj.JUMP)+"()" # execute a function
exec(test1)
print(testobj.JUMP)
canvas.pack()
app.mainloop()
# canvas.event_generate("<<Double-Button-1>>",x=100,y=100) # mouse pointer needs to be in widget and
# be moved between first and second block
#**************************************************************************
if __name__ == "__main__":
Graphmodel(*tuple(sys.argv[1:]))