简体   繁体   English

Python 2.6字体/颜色更改+错误窗口

[英]Python 2.6 font/colour change + error window

I just have two hopefully quick questions. 我只有两个希望很快的问题。 I'm using Python 2.6 我正在使用Python 2.6

  1. How should I go about changing the font and colour of a string with the tkfont class? 如何使用tkfont类更改字符串的字体和颜色? I seem to find tonnes of documentation about the different functions the tkfont class has, eg I think I should be using the tkfont.config(), and what to specify as the options, but nothing on how to apply it. 我似乎找到了大量有关tkfont类具有的不同功能的文档,例如,我认为我应该使用tkfont.config()以及将哪些内容指定为选项,但是如何使用它却一无所获。 eg if I wanted to make the string, 'Hello world' be the colour = blue, family = Courier and size = 15, how would I do that with tkfont? 例如,如果我想将字符串“ Hello world”设置为颜色=蓝色,家庭= Courier,尺寸= 15,那么如何使用tkfont做到这一点?

  2. Is there a generic python error window that can be called with a windows error sound, etc. Despite me asking for tkfont in the previous question, I'm fairly sure that I shouldn't do this part with tkinter and get the feeling that there's some default python error window that can be called. 是否存在可以通过Windows错误声音等调用的通用python错误窗口。尽管我在上一个问题中要求使用tkfont,但我相当确定我不应该对tkinter进行此操作,并感觉到一些可以调用的默认python错误窗口。

Sorry for these pretty nooby questions, I'm really stuck here. 很抱歉这些漂亮的nooby问题,我真的被困在这里。

Tkinter comes with many stantard dialogs. Tkinter带有许多标准对话框。 A good point of reference for these is the Standard Dialogs page on effbot. 这些的一个很好的参考点是effbot上的“ 标准对话框”页面。

I'll answer your question about colors when you clarify it a little. 稍作澄清后,我会回答您有关颜色的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM