Best Python code snippet using autotest_python
game.py
Source:game.py
1from bryhelper import *2import random3obj = {}4def newline():5 return obj['dmain'].add_br(2)6def action( actobj, *args, **kwargs ):7 d = { 'prsn': actobj.prsn, 'act': actobj.nm, 'btn_txt': actobj.btntxt}8 post_json( '../update_act_data', d, dummy )9 actobj.hide()10 11class PrsnAction():12 def __init__( self, e ):13 self.ar = e14 self.prsn = e[0]15 self.nm = e[1]16 self.btntxt = e[2]17 self.div = obj['dbody'].add_div('d2')18 self.div.add_br(1)19 self.div.add_span( '<b>' + self.prsn + '</b>' )20 self.div.add_br(2)21 self.div.add_span( self.ar[1] )22 self.div.add_br(2)23 self.div.add_button( self.btntxt, lambda *args: action( self ) )24 self.div.add_br(1)25 def hide(self):26 self.div.remove()27def refresh_data( rsp ):28 obj['dbody'].clear()29 for e in rsp['out']:30 obj['dbody'].add_br(1)31 PrsnAction(e)32def main():33 obj['dmain'] = doc.add_div('d1')34 obj['dmain'].add_br(1)35 obj['dmain'].elm <= P( 'ॲक्शन गेम' )36 obj['dmain'].add_button( '🔁', lambda *args: get_json( '../get_all_person_data', refresh_data ) )37 obj['dmain'].add_br(1)38 obj['dbody'] = obj['dmain'].add_div('d3')...
index.py
Source:index.py
1from bryhelper import *2obj = {}3def newline():4 obj['dmain'].add_br()5 obj['dmain'].add_br()6def redirect( url ):7 window.location.href = url8def main():9 obj['dmain'] = doc.add_div('d1')10 obj['dmain'].add_br()11 obj['dmain'].elm <= P( 'Index' )12 obj['dmain'].add_button( "ॲक्शन गेम", lambda x: redirect( 'game.html') )13 newline()14 obj['dmain'].add_button( "क्रिया सूची प्रशासन", lambda x: redirect( 'actadmin.html') )15 newline()...
uni2hex.py
Source:uni2hex.py
1from bryhelper import *2obj = {}3def newline():4 obj['dmain'].add_br()5 obj['dmain'].add_br()6def convert( *args, **kwargs ):7 out = ''.join( [f'&#x{format(ord(x),"x")};' for x in obj['txt_uni'].get()] )8 obj['txt_htm'].set(out)9def main():10 obj['dmain'] = doc.add_div('d1')11 obj['dmain'].add_br()12 obj['dmain'].elm <= P( 'Unicode to HTML' )13 obj['txt_uni'] = obj['dmain'].add_text( 20, 'Unicode', None)14 newline()15 obj['dmain'].add_button( "Convert", convert )16 newline()17 obj['txt_htm'] = obj['dmain'].add_text( 20, 'HTML', None)18 newline()...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!