在画布内插入文字

时间:2018-09-11 13:13:31

标签: html

我想做一些非常基本的事情。

我有一个带画布和按钮的div。我想在画布的中间写“ Signature 1”。

我该如何实现?

.signatureCanvas {
    border:1px solid #027C8C;
    width: 100%;
}
.signatureCanvas {
    width: 100%;
    max-height:200px;
}
<div class="signature-div text-center">
  <canvas id="signatureCanvas" class="signatureCanvas"></canvas>
  <div class="text-right">
    <button uib-tooltip="Upload Signature" class="btn btn-default" ng-click="vm.uploadSignature();">Speichern <i class="glyphicon glyphicon-cloud-upload"></i></button>
  </div>
</div>

1 个答案:

答案 0 :(得分:0)

您可以添加一个JavaScript块,将文本添加到画布中。

# new game
roomnames = list(roomdescriptions)  # copy the names of the rooms dictionary
random.shuffle(roomnames)

# picking the next room
if not roomnames:
    # reaching the boss level!
else:
    # take the next random room name, and get the room description for it
    nextroom = roomdescriptions[roomnames.pop()]