def build(self): self.box = h.HBox() self.box.intercept(1) self.box.ref(self) h.xpanel("") h.xbutton("Button 1", (self.bact, 1)) h.xbutton("Button 2", (self.bact, (2, ))) h.xbutton("Button 3", self.bact_noarg) h.xbutton("Button 4", (self.bact_2arg, ("hello", 4))) for i in range(3): h.xradiobutton("Radio " + str(i), (self.bact, i)) h.xmenu("Menu") for i in range(3): h.xbutton("Item " + str(i), (self.bact, i)) for i in range(3): h.xradiobutton("Radio " + str(i), (self.bact, i)) h.xcheckbox('checkbox', (self, 'cbstate'), self.cb) h.xstatebutton('state', (self, 'sbut'), self.st) h.xmenu() h.xpanel() self.g = h.Graph() self.g.menu_tool('graph menu tool 1', self.gcb, (self.gsel, 1)) h.xpanel("") h.xvalue("x", (self, "x"), 1, self.chgx) h.xcheckbox('checkbox', (self, 'cbstate'), self.cb) h.xstatebutton('state', (self, 'sbut'), self.st) h.xlabel('fixed label') h.xvarlabel((self, 'ss')) h.xslider((self, 'x'), 0, 20, self.slide) self.g.menu_tool('graph menu tool 2', self.gcb, (self.gsel, 2)) h.xpanel() self.box.intercept(0)
def __init__ (self, type, li) : self.izhtype = type vbox, hbox, hbox1 = h.VBox(), h.HBox(), h.HBox() self.vbox = vbox lil = len(li) self.cols, self.rows = {20:(4,5), 8:(4,2), 9:(3,3)}[lil] self.label=h.ref('================================================================================') vbox.intercept(1) h.xpanel("") h.xvarlabel(self.label) if newmodel(self.izhtype): h.xlabel("V' = (k*(V-vr)*(V-vt) - u + Iin)/C if (V>vpeak) V=c [reset]") h.xlabel("u' = a*(b*(V-vr) - u) if (V>vpeak) u=u+d") else: h.xlabel("v' = 0.04*v*v + f*v + g - u + Iin; if (v>thresh) v=c [reset]") h.xlabel("u' = a*(b*v - u); if (v>thresh) u=u+d") h.xpanel() hbox1.intercept(1) h.xpanel(""); h.xbutton("RUN",h.run); h.xpanel() self.xvalue('I0','I0') self.xvalue('I1','I1') self.xvalue('T1','T1') hbox1.intercept(0); hbox1.map("") hbox.intercept(1) for ii,(k,v) in enumerate(li.iteritems()): if ii%self.rows==0: h.xpanel("") h.xbutton(k, (lambda f, arg1, arg2: lambda: f(arg1,arg2))(p, k, v)) # alternative is to use functools.partial if ii%self.rows==self.rows-1: h.xpanel() hbox.intercept(0); hbox.map("") vbox.intercept(0); vbox.map("Spike patterns") self.label[0]=""
def bld(x, y): global g, tt, ttstr, grp, sgrp, pras tt = 0.0 ttstr = h.ref('tt=0.000000000') v = h.VBox() v.intercept(1) g = h.Graph() g.size(0, x, 0, y) h.xpanel("", 1) h.xvarlabel(ttstr) h.xvalue("group", (this_module, "grp"), 1, ttcallback) h.xslider((this_module, "sgrp"), 0, 100, ttscallback) h.xpanel() v.intercept(0) v.map("wave front", 100, 100, 700, 500) return v
return is_checked2 = h.ref(0) my_str = h.ref('yay!') h(""" proc onpress() { print "The HOC onpress function was called" } """) h.xpanel("Hello world") h.xlabel("Here is some text") h.xvalue("h.t", "t") h.xcheckbox("a checkbox", is_checked_ref, "onpress()") h.xcheckbox("a checkbox", (is_checked, 'checked'), onpress) h.xstatebutton("Toggle", is_checked2, onpress2) hb = h.HBox() hb.intercept(True) h.xbutton("finitialize", "finitialize(-65)") h.xbutton("run", "run()") h.xbutton("test", (buttontest, ("hallo", "goodbye"))) hb.intercept(False) hb.map() h.xvarlabel(my_str) #g = h.Graph() #g.addvar("v", "seg.v") h.xpanel() h.finitialize(-65)
printf("enter %g %s %s\\n", $&1, $o2, $s3) \ $&1 = 2 \ $o2 = new List() \ $s3 = "goodbye" \ }''') h('strdef hs') h('objref ho') h('hx = 0') h.hs = 'hello' h.hx = 1 h('change(&hx, ho, hs)') print(h.hx, h.ho, h.hs) h('load_file("nrngui.hoc")') h('obfunc hocstring() { return new String($s1) }') s = h.hocstring('hello world') h.xpanel("test1") h.xvarlabel(s.s) h.xpanel() h('strdef ss') h('ss = "hello world"') h.xpanel("test2") h.xvarlabel(h.ss) h.xpanel()