plotter/hpgl_qt.py

changeset 37
e0790756059d
parent 36
cb4124e3e75b
equal deleted inserted replaced
36:cb4124e3e75b 37:e0790756059d
114 mw = br.width() 114 mw = br.width()
115 mh = br.height() 115 mh = br.height()
116 self.qscene.removeItem(t0) 116 self.qscene.removeItem(t0)
117 # don't ask me why theses constants are here, they seem OK, that's all 117 # don't ask me why theses constants are here, they seem OK, that's all
118 t = self.qscene.addSimpleText(s, self.qfont) 118 t = self.qscene.addSimpleText(s, self.qfont)
119 t.scale(1.1 * cw/mw, -1.6 * ch/mh) 119 t.scale(1.0 * cw/mw, -1.6 * ch/mh)
120 x, y = self.pos 120 x, y = self.pos
121 t.moveBy(x,y) 121 t.moveBy(x,y)
122 br = t.boundingRect() 122 br = t.boundingRect()
123 t.moveBy(-0.5*cw, math.sqrt(2)*ch) 123 t.moveBy(-0.5*cw+8, math.sqrt(2)*ch - 13)
124 124
125 125
126 if __name__=='__main__': 126 if __name__=='__main__':
127 import sys 127 import sys
128 a = QtGui.QApplication(sys.argv) 128 a = QtGui.QApplication(sys.argv)

mercurial