1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| # Tkinter
import sys
if sys.version_info[0] > 2:
from tkinter import Label
else:
from Tkinter import Label
e = Label(text="AZWYMM", bd=0, highlightthickness=0, padx=0, pady=0, font=("Sans Serif", "12", "bold"))
print("Tkinter Label", e.winfo_reqwidth(), e.winfo_reqheight())
# PyQt
from PyQt4 import QtGui, QtCore
import sys
app = QtGui.QApplication(sys.argv)
label = QtGui.QLabel("AZWYMM", None)
label.setFont(QtGui.QFont("Sans Serif", 12, QtGui.QFont.Bold))
print("PyQt QtLabel", label.minimumSizeHint())
# pygtk
import pygtk
pygtk.require('2.0')
import gtk
import pango
# Sans tenir compte du RuntimeWarning ^^
window = gtk.Window(gtk.WINDOW_TOPLEVEL)
label = gtk.Label("AZWYMM")
label.modify_font(pango.FontDescription("sans bold 12"))
window.add(label)
print("pygtk gtk.Label", label.size_request())
# wxpython
import wx
app = wx.App(False)
frame = wx.Frame(None, wx.ID_ANY)
font = wx.Font(12, wx.NORMAL, wx.NORMAL, wx.BOLD, False, u'Sans Serif')
label = wx.StaticText(frame, -1, "AZWYMM")
label.SetFont(font)
print("wxpython", label.Size) |
Partager