Looping svg rectangles from database

后端 未结 1 967
眼角桃花
眼角桃花 2021-01-16 23:39

I am reading svg rectangles from a databse using python, I don\'t know if this is the right way, as it seems I am hardcoding, this because I want each rectangle to change co

相关标签:
1条回答
  • 2021-01-16 23:45

    As far as I can tell from you code, it looks like you should just be able to do:

    for i, row in enumerate(c): 
        box_x = ((row[3]-row[1])/2 + row[1] - 0.25)
        box_y = ((row[4]-row[2])/2 + row[2] - 0.25)
        move1 = box_y * 2
        try1 =  row[1] * 2  
    
        print('<rect id="rectangle{0}" class="rectangles" x="{1}" y="{2}" width="{3}" height="{4}" onmousemove="myFunction3()"><title>Owned by {5}</title></rect>'.format(i, row[1], row[2], row[3] - row[1], row[4] - row[2], row[6]))
    
    0 讨论(0)
提交回复
热议问题