rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
print new_string
def escape(old_string): # Escape literal < (unmatched tag) and new line from string. hanging = [] open = 0 pending = 0 for i in range(len(old_string)): if old_string[i] == '<': if open != 0: hanging.append(pending) pending = i continue open += 1 pending = i elif old_string[i] == '>': if open > 0: open -= 1 if open ...
def decode_cdata(s): return saxutils.unescape(s)
def decode_cdata(s): return saxutils.unescape(s)
cat_name = decode_cdata(self.text["cat"])
cat_name = self.text["cat"]
def decode_cdata(s): return saxutils.unescape(s)
self.item.q = decode_cdata(self.text["Q"])
self.item.q = self.text["Q"]
def decode_cdata(s): return saxutils.unescape(s)
self.item.a = decode_cdata(self.text["A"])
self.item.a = self.text["A"]
def decode_cdata(s): return saxutils.unescape(s)
def encode_cdata(s): return "<![CDATA[" + saxutils.escape(s.encode("utf-8")) + "]]>"
def write_item_XML(e, outfile, reset_learning_data=False): def encode_cdata(s): return "<![CDATA[" + saxutils.escape(s.encode("utf-8")) + "]]>" if reset_learning_data == False: print >> outfile, "<item id=\""+str(e.id) + "\"" \ + " gr=\""+str(e.grade) + "\"" \ + " e=\""+ "%.3f" % e.easiness + "\"" \ + " ac_rp=\""+str...
print >> outfile, " <name><![CDATA["+category.name.encode("utf-8") \ +"]]></name>"
print >> outfile, " <name>" + encode_cdata(category.name) + "</name>"
def write_category_XML(category, outfile, reset_learning_data): if reset_learning_data == True: active = True else: active = category.active print >> outfile, "<category active=\"" \ + bool_to_digit(active) + "\">" print >> outfile, " <name><![CDATA["+category.name.encode("utf-8") \ +"]]></name>" print >> outfile, "<...
self.show_button.setText("Show answer")
self.show_button.setText("&Show answer")
def showAnswer(self):
self.adjustSize()
def clearQuestion(self): self.item = None self.adjustSize() self.question_label.setText("Question:") self.question.setText("") self.answer.setText("") self.show_button.setEnabled(0) self.editCurrentItemAction.setEnabled(0) self.deleteCurrentItemAction.setEnabled(0) self.grades.setEnabled(0)
self.adjustSize()
def updateQuestion(self): self.adjustSize() if self.item == None: return if self.item.cat.name != "<default>": self.question_label.setText(preprocess("Question: " + \ self.item.cat.name)) self.question.setText(preprocess(self.item.q)) if self.answer.text() != "": self.answer.setText(preprocess(self.item.a))
continue
break
def preprocess(old_string): # Escape literal < (unmatched tag) and new line from string. hanging = [] open = 0 pending = 0 for i in range(len(old_string)): if old_string[i] == '<': if open != 0: hanging.append(pending) pending = i continue open += 1 pending = i elif old_string[i] == '>': if open > 0: open -= 1 if o...
turn = None semimoveCount = 0 locs = {} for x in range(8): for y in range(8): locs[(x,y)] = E b_pieces = {} w_pieces = {} for p in pieces: b_pieces[p] = [] w_pieces[p] = [] history = []
def __init__(self): self.turn = None self.semimoveCount = 0 self.locs = {} for x in range(8): for y in range(8): self.locs[(x,y)] = E self.b_pieces = {} self.w_pieces = {} for p in pieces: self.b_pieces[p] = [] self.w_pieces[p] = [] self.history = [] self.enpassant = None def enpassant_possible(self, pos): return...
def scanPos(s): return (letters[s[0]], int(s[1])-1)
history = []
self.history = [] self.enpassant = None
def setup(self): """setups initial position; __str__() will show the following:
if(new != self.getLoc(pos)): raise "hunk failed" self.locs[pos] = old else: for (pos, old, new) in patch: if(old != self.getLoc(pos)): raise "hunk failed" self.locs[pos] = new
self.applyHunk((pos, new, old)) else: for hunk in patch: self.applyHunk(hunk)
def applyPatch(self, patch, rev=False): """Applies a patch (a list of hunks) to the current position.
"""(parsed) move is:
"""a (parsed) move is:
def move(self, sym, src, dst, options): """(parsed) move is: (piece, src, dst, options), where dict options may contain the following keys: promote (None, R, Q, B, N), capture (True, False), hybrid (True, False), check (None, check, mate). all keys except 'promote' may be ignored""" src_piece = self.locs[src] if src_pi...
promote (None, R, Q, B, N), capture (True, False), hybrid (True, False), check (None, check, mate).
promote (None, R, Q, B, N), capture (True, False), hybrid, i.e. 'going to hybrid' (True, False), check (None, check, mate).
def move(self, sym, src, dst, options): """(parsed) move is: (piece, src, dst, options), where dict options may contain the following keys: promote (None, R, Q, B, N), capture (True, False), hybrid (True, False), check (None, check, mate). all keys except 'promote' may be ignored""" src_piece = self.locs[src] if src_pi...
print loc, piece
def mouseDown(self, event): event_coords = event.x, event.y xcell, ycell = event.x / self.xsize - 1, 7 - (event.y / self.ysize - 1) loc = self.getLoc(event.x, event.y) if loc: piece = self.board[loc] print loc, piece if piece == None: print 'mouseDown: empty' self.selected = None elif piece.ishybrid(): img1, img2 = sel...
print 'mouseDown: empty'
def mouseDown(self, event): event_coords = event.x, event.y xcell, ycell = event.x / self.xsize - 1, 7 - (event.y / self.ysize - 1) loc = self.getLoc(event.x, event.y) if loc: piece = self.board[loc] print loc, piece if piece == None: print 'mouseDown: empty' self.selected = None elif piece.ishybrid(): img1, img2 = sel...
print 'mouseDown: upper'
def mouseDown(self, event): event_coords = event.x, event.y xcell, ycell = event.x / self.xsize - 1, 7 - (event.y / self.ysize - 1) loc = self.getLoc(event.x, event.y) if loc: piece = self.board[loc] print loc, piece if piece == None: print 'mouseDown: empty' self.selected = None elif piece.ishybrid(): img1, img2 = sel...
print 'mouseDown: lower'
def mouseDown(self, event): event_coords = event.x, event.y xcell, ycell = event.x / self.xsize - 1, 7 - (event.y / self.ysize - 1) loc = self.getLoc(event.x, event.y) if loc: piece = self.board[loc] print loc, piece if piece == None: print 'mouseDown: empty' self.selected = None elif piece.ishybrid(): img1, img2 = sel...
print 'mouseDown: both'
def mouseDown(self, event): event_coords = event.x, event.y xcell, ycell = event.x / self.xsize - 1, 7 - (event.y / self.ysize - 1) loc = self.getLoc(event.x, event.y) if loc: piece = self.board[loc] print loc, piece if piece == None: print 'mouseDown: empty' self.selected = None elif piece.ishybrid(): img1, img2 = sel...
print 'mouseDown: not hybrid'
def mouseDown(self, event): event_coords = event.x, event.y xcell, ycell = event.x / self.xsize - 1, 7 - (event.y / self.ysize - 1) loc = self.getLoc(event.x, event.y) if loc: piece = self.board[loc] print loc, piece if piece == None: print 'mouseDown: empty' self.selected = None elif piece.ishybrid(): img1, img2 = sel...
print 'mouseDown: out of range'
def mouseDown(self, event): event_coords = event.x, event.y xcell, ycell = event.x / self.xsize - 1, 7 - (event.y / self.ysize - 1) loc = self.getLoc(event.x, event.y) if loc: piece = self.board[loc] print loc, piece if piece == None: print 'mouseDown: empty' self.selected = None elif piece.ishybrid(): img1, img2 = sel...
print self.selected
def mouseMove(self, event): print self.selected if self.selected: loc, piece, item_shifts = self.selected for item, (x, y) in item_shifts: self.c.coords(item, x+event.x, y+event.y) self.c.tkraise(item)
print self.selected
def mouseUp(self, event): print self.selected if self.selected: loc, piece, item_shifts = self.selected newloc = self.getLoc(event.x, event.y) if newloc: try: self.board.move(piece, loc, newloc) except IllegalMove, msg: print IllegalMove, msg self.selected = None else: print 'mouseUp: not selected, nothing to do'
self.board.move(piece, loc, newloc)
options = {} if piece.__class__ == PawnPiece: col = self.board.turn z = (col, newloc.y) if z == (white, 7) or z == (black, 0): if self.alwaysPromote: options['promote'] = self.alwaysPromote(col) else: print 'not implemented: alwaysPromote is unset' self.board.move(piece, loc, newloc, options)
def mouseUp(self, event): print self.selected if self.selected: loc, piece, item_shifts = self.selected newloc = self.getLoc(event.x, event.y) if newloc: try: self.board.move(piece, loc, newloc) except IllegalMove, msg: print IllegalMove, msg self.selected = None else: print 'mouseUp: not selected, nothing to do'
else: print 'mouseUp: not selected, nothing to do'
def mouseUp(self, event): print self.selected if self.selected: loc, piece, item_shifts = self.selected newloc = self.getLoc(event.x, event.y) if newloc: try: self.board.move(piece, loc, newloc) except IllegalMove, msg: print IllegalMove, msg self.selected = None else: print 'mouseUp: not selected, nothing to do'
pass
from string import upper key = upper(event.keysym) if key == 'BACKSPACE' or key == 'LEFT': self.undo() elif key == 'RIGHT': self.redo() elif key == 'D': print 'Current position:' print self.board elif key == 'M': print 'All legal moves:' for patch in self.board.iterMove(('*', ), ('*', ), ('*', )): print patch
def keyRelease(self, event): pass
res += GameHist.str_tag(tag, self.tags[tag])
res += GameHist_PGN.str_tag(tag, self.tags[tag])
def str_tags(self): res = '' # required first... for tag in GameHist.required_tags: res += GameHist.str_tag(tag, self.tags[tag]) # ...then optional tags for tag in self.tags.keys(): if not tag in GameHist.required_tags: res += GameHist.str_tag(tag, self.tags[tag]) return res
def getLoc(self, pos):
def __getitem__(self, pos):
def getLoc(self, pos): return self.locs[pos]
loc = self.getLoc((x, y))
loc = self[(x, y)]
def __str__(self): "shows current position in human-readable format" s = '' s += ' | a | b | c | d | e | f | g | h | \n' s += '-+---+---+---+---+---+---+---+---+-\n' for y in range(7, -1, -1): for i in range(2): if i==1: extra = str(y+1) else: extra = ' ' s += extra for x in range(8): s += '|' loc = self.getLoc((x, y))...
self.locs[pos] = (p, white)
self[pos] = (p, white)
def setup(self): """setups initial position; __str__() will show the following:
self.locs[pos] = (p, black) def applyHunk(self, (pos, old, new)):
self[pos] = (p, black) def applyHunk(self, (pos, (old, new))):
def setup(self): """setups initial position; __str__() will show the following:
if(old != self.getLoc(pos) or new == None):
if(old != self[pos] or new == None):
def applyHunk(self, (pos, old, new)): if (old, new) == (E, None): # en-passant is possible on next semimove self.enpassant = (pos, self.semimoveCount+1) elif (old, new) == (None, E): # reverse-hunk for en-passant # FIXME: check the state of semimoveCount if self.enpassant_possible(pos): # ok, en-passant is possible on ...
self.locs[pos] = new
self[pos] = new
def applyHunk(self, (pos, old, new)): if (old, new) == (E, None): # en-passant is possible on next semimove self.enpassant = (pos, self.semimoveCount+1) elif (old, new) == (None, E): # reverse-hunk for en-passant # FIXME: check the state of semimoveCount if self.enpassant_possible(pos): # ok, en-passant is possible on ...
for (pos, old, new) in reverse(patch): self.applyHunk((pos, new, old))
for (pos, (old, new)) in reverse(patch): self.applyHunk((pos, (new, old)))
def applyPatch(self, patch, rev=False): """Applies a patch (a list of hunks) to the current position.
src_piece = self.locs[src]
src_piece = self[src]
def move(self, sym, src, dst, options): """a (parsed) move is: (piece, src, dst, options), where dict options may contain the following keys: promote (None, R, Q, B, N), capture (True, False), hybrid, i.e. 'going to hybrid' (True, False), check (None, check, mate). all keys except 'promote' may be ignored""" src_piece...
def isHybriding(self):
def isHybridable(self):
def isHybriding(self): return False
def isHybriding(self):
def isHybridable(self):
def isHybriding(self): return True
elif sym[0] == self.sym: rest = sym[1] elif sym[1] == self.sym: rest = sym[0] else: raise IllegalMove, "no such piece on this position" return (source, rest)
else: (sym0, sym1) = sym if sym0 == self.sym: rest = sym1 elif sym1 == self.sym: rest = sym0 else: raise IllegalMove, "no such piece on this position" return (src, rest)
def leave(self, src): "returns a pos-patch 'the piece leaves position'. hybriding" if src == E: raise IllegalMove, "attempt to move from empty position" (sym, col) = src if col != self.col: raise IllegalMove, "attempt to move evemy's piece" if sym == self.sym: rest = E elif sym[0] == self.sym: rest = sym[1] elif sym[1]...
if pieceObjects[sym].isHybridable(): return (dst, (sort2(sym, self.sym), self.col))
if pieceObjects[dst].isHybridable(): return (dst, (sort2((sym, self.sym)), self.col))
def join(self, dst): "returns a pos-patch 'the piece joins position'. hybriding" me = (self.sym, self.col) if dst == E: return (dst, me) (sym, col) = dst if col != self.col: return (dst, me) # try to make a new hybrid if pieceObjects[sym].isHybridable(): return (dst, (sort2(sym, self.sym), self.col)) else: raise Illega...
'Uncultivable' : {'Rocky':1./8,
'unknown' : {'Rocky':1./8,
def CombineTables(Prob,Mult,fac,newkey,ret): tot=0 ret[(fac,newkey)]=Prob[fac].copy(); for i in ret[(fac,newkey)]: if (i in Mult): ret[(fac,newkey)][i]=ret[(fac,newkey)][i]*Prob[fac][i]; tot+=ret[(fac,newkey)][i] for i in Prob[fac]: ret[(fac,newkey)][i]/=tot; return ret;
def getPlanet(fac,radpair=None):
def getPlanet(fac,radpair=None,name=''):
def getPlanet(fac,radpair=None): global combined_planet_prob if not fac in planetprob: fac=None if not (fac,radpair) in combined_planet_prob: if (radpair in starplanetmult): combined_planet_prob=CombineTables(planetprob,starplanetmult[radpair],fac,radpair,combined_planet_prob) else: radpair=None if (radpair==None): pli...
def getPlanets(fac,planets, sun_radius):
def getPlanets(fac,planets, sun_radius,name):
def getPlanets(fac,planets, sun_radius): import starCodes pair=starCodes.sizeToNum(sun_radius) numplan=rak.randint(0,5) if (numplan>=4): numplan = rak.randint(1,10) plist=[] moons=[] moonindex=[] j=0 for i in range(numplan): plan=getPlanet(fac,pair) plist.append(plan) mi=[] if (plan in moonprob): iter=0 while (rak.rand...
plan=getPlanet(fac,pair)
plan=getPlanet(fac,pair,name)
def getPlanets(fac,planets, sun_radius): import starCodes pair=starCodes.sizeToNum(sun_radius) numplan=rak.randint(0,5) if (numplan>=4): numplan = rak.randint(1,10) plist=[] moons=[] moonindex=[] j=0 for i in range(numplan): plan=getPlanet(fac,pair) plist.append(plan) mi=[] if (plan in moonprob): iter=0 while (rak.rand...
def getPlanetsString(fac,planets, sun_radius):
def getPlanetsString(fac,planets, sun_radius,name):
def getPlanetsString(fac,planets, sun_radius): ret="" for p in getPlanets(fac,planets,sun_radius): if (len(ret)): ret+=' ' ret+=p return ret
for p in getPlanets(fac,planets,sun_radius):
for p in getPlanets(fac,planets,sun_radius,name):
def getPlanetsString(fac,planets, sun_radius): ret="" for p in getPlanets(fac,planets,sun_radius): if (len(ret)): ret+=' ' ret+=p return ret
newchild.setAttribute('value',getPlanetsString(getVal(s,'faction'),planets,float(getVal(s,"sun_radius"))))
newchild.setAttribute('value',getPlanetsString(getVal(s,'faction'),planets,float(getVal(s,"sun_radius")),s.getAttribute('name')))
def getPlanetsString(fac,planets, sun_radius): ret="" for p in getPlanets(fac,planets,sun_radius): if (len(ret)): ret+=' ' ret+=p return ret
print '\r' sys.stderr.write('Executing post query: '+post+'\n')
print '\n'
def execute(conn,url,post): print '\r' sys.stderr.write('Executing post query: '+post+'\n') try: packet = Packet(conn, post) #if it crashes we dont care..this is python command = packet.getChar() except: command='UNKNOWN' print "EXCEPTION: "+str(url)+"\n"+str(post); packet = Packet(conn, '') if command==ACCT_LOGIN: use...
print '\r'
def execute(conn,url,post): #print '\n' # Can't write to stderr since on IIS it is concatenated with stdout. #sys.stderr.write('Executing post query: '+post+'\n') try: packet = Packet(conn, post) #if it crashes we dont care..this is python command = packet.getChar() except: command='UNKNOWN' print "EXCEPTION: "+str(url...
sys.stdout.write("Content-Type: text/html\r\n\r\n");
sys.stdout.write("Content-Type: text/html\r\n");
def execute(conn,url,post): #print '\n' # Can't write to stderr since on IIS it is concatenated with stdout. #sys.stderr.write('Executing post query: '+post+'\n') try: packet = Packet(conn, post) #if it crashes we dont care..this is python command = packet.getChar() except: command='UNKNOWN' print "EXCEPTION: "+str(url...
exec(str(self.mle.text()))
exec(str(self.mle.text()), globals(),globals())
def Run(self): self.qpl.set_stream() exec(str(self.mle.text()))
self.command=str((QFileDialog.getOpenFileName()))
self.command=str((QFileDialog.getOpenFileName(".","*.py",)))
def open(self): self.command=str((QFileDialog.getOpenFileName())) print self.command f=open(self.command,"r") self.command=f.read() print self.command self.mle.setText(self.command)
plw3d(1.0, 1.0, 1.2, -3.0, 3.0, -3.0, 3.0, -7., 8., alt[k], az[k])
plw3d(1.0, 1.0, 1.2, -3.0, 3.0, -3.0, 3.0, zmin, zmax, alt[k], az[k])
def main(): x = 3.*(arrayrange(XPTS) - (XPTS / 2)) / float(XPTS / 2) y = 3.*(arrayrange(YPTS) - (YPTS / 2)) / float(YPTS / 2) x.shape = (-1,1) z = 3. * (1.-x)*(1.-x) * exp(-(x*x) - (y+1.)*(y+1.)) - \ 10. * (x/5. - pow(x,3.) - pow(y,5.)) * exp(-x*x-y*y) - \ 1./3. * exp(-(x+1)*(x+1) - (y*y))
_Cplcont(z, kx, lx, ky, ly, clev, pltr, (xg, yg)) plcont.__doc__ = _Cplcont.__doc__
_plcont(z, kx, lx, ky, ly, clev, pltr, (xg, yg)) plcont.__doc__ = _plcont.__doc__
def plcont(z, *args): z = Numeric.asarray(z) if len(args) > 4 and type(args[0]) == types.IntType: for i in range(1,4): if type(args[i]) != types.IntType: raise ValueError, 'Expected 4 ints for kx,lx,ky,ly' else: # these 4 args are the kx, lx, ky, ly ints default = 0 kx,lx,ky,ly = args[0:4] args = args[4:] else: defaul...
_Cplstyl = plstyl
_plstyl = plstyl
def plcont(z, *args): z = Numeric.asarray(z) if len(args) > 4 and type(args[0]) == types.IntType: for i in range(1,4): if type(args[i]) != types.IntType: raise ValueError, 'Expected 4 ints for kx,lx,ky,ly' else: # these 4 args are the kx, lx, ky, ly ints default = 0 kx,lx,ky,ly = args[0:4] args = args[4:] else: defaul...
_Cplstyl(m,s) plstyl.__doc__ = _Cplstyl.__doc__
_plstyl(m,s) plstyl.__doc__ = _plstyl.__doc__
def plstyl(*args): if len(args) == 3: n,m,s = args else: m,s = args n = 1 if n == 0: m = [] s = [] if type(m) == types.IntType: m = [m] if type(s) == types.IntType: s = [s] _Cplstyl(m,s)
_Cplshades = plshades
_plshades = plshades
def plstyl(*args): if len(args) == 3: n,m,s = args else: m,s = args n = 1 if n == 0: m = [] s = [] if type(m) == types.IntType: m = [m] if type(s) == types.IntType: s = [s] _Cplstyl(m,s)
_Cplshades(z, xmin, xmax, ymin, ymax, clevel, fill_width, cont_color, cont_width,
_plshades(z, xmin, xmax, ymin, ymax, clevel, fill_width, cont_color, cont_width,
def plshades(z, xmin, xmax, ymin, ymax, clevel, fill_width, cont_color, cont_width, rect, *args): pltr = pltr0 xg = None yg = None if len(args) >= 3: pltr, xg, yg = args[0:3] args = args[3:] wrap = 0 if len(args) == 1: wrap = args[0] elif len(args) != 0: raise 'ValueError', 'too many arguments' if wrap == 1: z = Nume...
plshades.__doc__ = _Cplshades.__doc__
plshades.__doc__ = _plshades.__doc__
def plshades(z, xmin, xmax, ymin, ymax, clevel, fill_width, cont_color, cont_width, rect, *args): pltr = pltr0 xg = None yg = None if len(args) >= 3: pltr, xg, yg = args[0:3] args = args[3:] wrap = 0 if len(args) == 1: wrap = args[0] elif len(args) != 0: raise 'ValueError', 'too many arguments' if wrap == 1: z = Nume...
m = re.match('[ \t]+\{[ \t]\(char \*\)"([a-zA-Z_0-9]+)"(.*)\},', line)
m = re.match('[ \t]+\{[ \t]\(char \*\)"([a-zA-Z_0-9]+)"(.*)\, NULL \},', line)
def main(): if len(sys.argv) != 3: print 'usage: makedocstrings infile outfile' infile = open(sys.argv[1], 'rt') outfile = open(sys.argv[2], 'wt') docstrings = {} while 1: line = infile.readline() if not line: break m = re.match(r'#define _doc_([a-zA-Z_0-9]+)', line) if m: name = m.group(1) value = '_doc_'+name docs...
break
m = re.match('[ \t]+\{[ \t]\(char \*\)"([a-zA-Z_0-9]+)"(.*)\},', line) if not m: break
def main(): if len(sys.argv) != 3: print 'usage: makedocstrings infile outfile' infile = open(sys.argv[1], 'rt') outfile = open(sys.argv[2], 'wt') docstrings = {} while 1: line = infile.readline() if not line: break m = re.match(r'#define _doc_([a-zA-Z_0-9]+)', line) if m: name = m.group(1) value = '_doc_'+name docs...
s.tk.call( s._w, 'cmd', 'plcol', c )
s.cmd( 'plcol', c )
def plcol(s,c):
s.tk.call( s._w, 'cmd', 'plenv', xmin, xmax, ymin, ymax, i, j )
s.cmd( 'plenv', xmin, xmax, ymin, ymax, i, j )
def plenv( s, xmin, xmax, ymin, ymax, i, j ):
s.tk.call( s._w, 'cmd', 'pleop' )
s.cmd( 'pleop' )
def pleop(s):
s.tk.call( s._w, 'cmd', 'pllab', xlab, ylab, tlab )
s.cmd( 'pllab', xlab, ylab, tlab )
def pllab( s, xlab, ylab, tlab ):
class PlXframe(Widget):
class PlXframe(Frame):
def plpoin( s, xs, ys, mark ):
Widget.__init__( s, master, 'frame', cnf, kw )
Frame.__init__( s, master )
def __init__( s, master=None, cnf={}, **kw ):
s.f = Frame( s, kw ) s.f.rowconfigure( 0, weight=1, minsize=0 ) s.f.columnconfigure( 0, weight=1, minsize=0 ) s.f.plf = Plframe( s, kw ) s.f.plf.grid( row=0, column=0, sticky='nsew' ) s.plf = s.f.plf
s.rowconfigure( 1, weight=1, minsize=0 ) s.rowconfigure( 2, weight=1, minsize=0 ) s.plf = Plframe( s, kw ) s.plf.grid( row=1, column=0 )
def __init__( s, master=None, cnf={}, **kw ):
s.f.pack( expand=1, fill=BOTH )
def __init__( s, master=None, cnf={}, **kw ):
s.ftop.pack( expand=1, fill=X )
s.ftop.grid( row=0, columnspan=2, sticky='ew' )
def build_menu_bar(s):
x0 = float(x0) y0 = float(y0) x1 = float(x1) y1 = float(y1)
def zoom_coords( s, x0, y0, x1, y1, opt ):
def cmd(s,*args): "This function cores the Python." pass
def cmd( s, *args ): "Invoke a subcommand on the plframe widget." apply( s.tk.call, (s.plf._w, 'cmd',) + _flatten(args) )
def cmd(s,*args):
s.tk.call( s.plf._w, CMD, 'pladv', page )
s.cmd( 'pladv', page )
def pladv( s, page ):
s.tk.call( s.plf._w, CMD, 'plaxes', x0, y0, xopt, xtick, nxsub, yopt, ytick, nysub )
s.cmd( 'plaxes', x0, y0, xopt, xtick, nxsub, yopt, ytick, nysub )
def plaxes( s, x0, y0, xopt, xtick, nxsub, yopt, ytick, nysub ):
s.tk.call( s.plf._w, CMD, 'plbop' )
s.cmd( 'plbop' )
def plbop(s):
s.tk.call( s.plf._w, CMD, 'plbox', xopt, xtick, nxsub, yopt, ytick, nysub )
s.cmd( 'plbox', xopt, xtick, nxsub, yopt, ytick, nysub )
def plbox( s, xopt, xtick, nxsub, yopt, ytick, nysub ):
s.tk.call( s.plf._w, CMD, 'plbox3', xopt, xlabel, xtick, nsubx, yopt, ylabel, ytick, nsuby, zopt, zlabel, ztick, nsubz )
s.cmd( 'plbox3', xopt, xlabel, xtick, nsubx, yopt, ylabel, ytick, nsuby, zopt, zlabel, ztick, nsubz )
def plbox3( s, xopt, xlabel, xtick, nsubx,
s.tk.call( s.f.plf._w, CMD, 'plcol', c )
s.cmd( 'plcol', c )
def plcol(s,c):
s.tk.call( s.f.plf._w, CMD, 'plcol1', col1 )
s.cmd( 'plcol1', col1 )
def plcol1( s, col1 ):
s.tk.call( s.f.plf._w, 'cmd', 'plenv', xmin, xmax, ymin, ymax, i, j )
s.cmd( 'plenv', xmin, xmax, ymin, ymax, i, j )
def plenv( s, xmin, xmax, ymin, ymax, i, j ):
s.tk.call( s.f.plf._w, 'cmd', 'pleop' )
s.cmd( 'pleop' )
def pleop(s):
s.f.plf.setvar( 'wv', '0' )
s.plf.setvar( 'wv', '0' )
def pleop(s):
s.f.plf.waitvar( 'wv' )
s.plf.waitvar( 'wv' )
def pleop(s):
s.f.plf.setvar( 'wv', 1 )
s.plf.setvar( 'wv', 1 )
def clearpage(s):
s.tk.call( s.f.plf._w, CMD, 'plfont', ifnt )
s.cmd( 'plfont', ifnt )
def plfont( s, ifnt ):
s.tk.call( s.f.plf._w, CMD, 'plfontld', fnt )
s.cmd( 'plfontld', fnt )
def plfontld( s, fnt ):
s.tk.call( s.f.plf._w, CMD, 'plhls', h, l, s )
s.cmd( 'plhls', h, l, s )
def plhls( s, h, l, s ):
s.tk.call( s.f.plf._w, CMD, 'pljoin', x1, y1, x2, y2 )
s.cmd( 'pljoin', x1, y1, x2, y2 )
def pljoin( s, x1, y1, x2, y2 ):
s.tk.call( s.f.plf._w, 'cmd', 'pllab', xlab, ylab, tlab )
s.cmd( 'pllab', xlab, ylab, tlab )
def pllab( s, xlab, ylab, tlab ):
s.tk.call( s.f.plf._w, CMD, 'pllsty', lin )
s.cmd( 'pllsty', lin )
def pllsty( s, lin ):
s.tk.call( s.f.plf._w, CMD, 'plmtex', side, disp, pos, just, text )
s.cmd( 'plmtex', side, disp, pos, just, text )
def plmtex( s, side, disp, pos, just, text ):
s.tk.call( s.f.plf._w, CMD, 'plprec', setp, prec )
s.cmd( 'plprec', setp, prec )
def plprec( s, setp, prec ):
s.tk.call( s.f.plf._w, CMD, 'plpsty', patt )
s.cmd( 'plpsty', patt )
def plpsty( s, patt ):
s.tk.call( s.f.plf._w, CMD, 'plptex', x, y, dx, dy, just, text )
s.cmd( 'plptex', x, y, dx, dy, just, text )
def plptex( s, x, y, dx, dy, just, text ):
s.tk.call( s.f.plf._w, CMD, 'plreplot' )
s.cmd( 'plreplot' )
def plreplot( s ):
s.tk.call( s.f.plf._w, CMD, 'plrgb', r, g, b )
s.cmd( 'plrgb', r, g, b )
def plrgb( s, r, g, b ):
s.tk.call( s.f.plf._w, CMD, 'plrgb1', r, g, b )
s.cmd( 'plrgb1', r, g, b )
def plrgb1( s, r, g, b ):
s.tk.call( s.f.plf._w, CMD, 'plschr', dflt, scale )
s.cmd( 'plschr', dflt, scale )
def plschr( s, dflt, scale ):
s.tk.call( s.f.plf._w, CMD, 'plssub', nx, ny )
s.cmd( 'plssub', nx, ny )
def plssub( s, nx, ny ):