python3.7怎么设置字体大小_gtk3按钮如何设置字体大小

fromgi.repositoryimportGtkclassLabelWindow(Gtk.Window):def__init__(self):Gtk.Window.__init__(self,title="Label Example")hbox=Gtk.Box(spacing=10)hbox.set_homogeneous(False)vbox_left=Gtk.Box(orientation=Gtk.Orientation.VERTICAL,spacing=10)vbox_left.set_homogeneous(False)vbox_right=Gtk.Box(orientation=Gtk.Orientation.VERTICAL,spacing=10)vbox_right.set_homogeneous(False)hbox.pack_start(vbox_left,True,True,0)hbox.pack_start(vbox_right,True,True,0)label=Gtk.Label("This is a normal label")vbox_left.pack_start(label,True,True,0)label=Gtk.Label()label.set_text("This is a left-justified label.\nWith multiple lines.")label.set_justify(Gtk.Justification.LEFT)vbox_left.pack_start(label,True,True,0)label=Gtk.Label("This is a right-justified label.\nWith multiple lines.")label.set_justify(Gtk.Justification.RIGHT)vbox_left.pack_start(label,True,True,0)label=Gtk.Label("This is an example of a line-wrapped label. It ""should not be taking up the entire ""width allocated to it, but automatically ""wraps the words to fit.\n"" It supports multiple paragraphs correctly, ""and correctly adds ""many extra spaces. ")label.set_line_wrap(True)vbox_right.pack_start(label,True,True,0)label=Gtk.Label("This is an example of a line-wrapped, filled label. ""It should be taking ""up the entire width allocated to it. ""Here is a sentence to prove ""my point. Here is another sentence. ""Here comes the sun, do de do de do.\n"" This is a new paragraph.\n"" This is another newer, longer, better ""paragraph. It is coming to an end, ""unfortunately.")label.set_line_wrap(True)label.set_justify(Gtk.Justification.FILL)vbox_right.pack_start(label,True,True,0)label=Gtk.Label()label.set_markup("Text can be small, big, ""bold, italic and even point to ""somewhere in the internets.")label.set_line_wrap(True)vbox_left.pack_start(label,True,True,0)label=Gtk.Label.new_with_mnemonic("_Press Alt + P to select button to the right")vbox_left.pack_start(label,True,True,0)label.set_selectable(True)button=Gtk.Button(label="Click at your own risk")label.set_mnemonic_widget(button)vbox_right.pack_start(button,True,True,0)self.add(hbox)window=LabelWindow()window.connect("delete-event",Gtk.main_quit)window.show_all()Gtk.main()

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值