forked from Pavel/labygui
Added microsteps for angle (shift+left/right)
This commit is contained in:
parent
122eb5ca50
commit
efaa95561c
16
labygui.py
16
labygui.py
|
@ -46,14 +46,14 @@ def previous(event):
|
|||
index -= 1
|
||||
aller_selon(path)
|
||||
|
||||
def left(event):
|
||||
def left(event, step):
|
||||
global path, index
|
||||
path[index] = (round(path[index][0] + 0.1, 1), path[index][1])
|
||||
path[index] = (round(path[index][0] + step, 2), path[index][1])
|
||||
aller_selon(path)
|
||||
|
||||
def right(event):
|
||||
def right(event, step):
|
||||
global path, index
|
||||
path[index] = (round(path[index][0] - 0.1, 1), path[index][1])
|
||||
path[index] = (round(path[index][0] - step, 2), path[index][1])
|
||||
aller_selon(path)
|
||||
|
||||
def up(event):
|
||||
|
@ -83,8 +83,10 @@ master.bind('<Return>', add)
|
|||
master.bind('<BackSpace>', remove)
|
||||
master.bind('<Prior>', previous)
|
||||
master.bind('<Next>', next)
|
||||
master.bind('<Left>', left)
|
||||
master.bind('<Right>', right)
|
||||
master.bind('<Left>', lambda e: left(e, 0.1))
|
||||
master.bind('<Right>', lambda e: right(e, 0.1))
|
||||
master.bind('<Shift-KeyPress-Left>', lambda e: left(e, 0.01))
|
||||
master.bind('<Shift-KeyPress-Right>', lambda e: right(e, 0.01))
|
||||
master.bind('<Up>', up)
|
||||
master.bind('<Down>', down)
|
||||
master.bind('p', print_code)
|
||||
|
@ -105,7 +107,7 @@ def draw_line(x1, y1, x2, y2, color):
|
|||
canvas.create_line(x1 + 1, y1 + 1, x2 + 1, y2 + 1, fill = color, width = 2.0)
|
||||
|
||||
def draw_help():
|
||||
help = 'change angle: Left/Right, change length: Up/Down, add/remove element: Enter/BackSpace, previous/next element: PgUp/PgDn, print code: P, exit: Esc'
|
||||
help = 'change angle: [Shift+] Left/Right, change length: Up/Down, add/remove element: Enter/BackSpace, previous/next element: PgUp/PgDn, print code: P, exit: Esc'
|
||||
canvas.create_text(4, screen_h + 36, anchor = NW, text = help, fill = 'black')
|
||||
|
||||
def draw_path():
|
||||
|
|
Loading…
Reference in New Issue