PyQT,Sharp Zaurus和QTextBrowser中的颜色 [英] PyQT, Sharp Zaurus and color in the QTextBrowser

查看:87
本文介绍了PyQT,Sharp Zaurus和QTextBrowser中的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好!


我是一名初学Python程序员,我已经非常喜欢它了。由于我的
Sharp Zaurus有一个相当完整的Python环境,包括PyQT,我认为它将是编写一些不错的完美语言

的东西在我的Zaurus上。我在Z上真正错过的是一个很好的

Jabber客户端。这就是为什么我要建立自己的。事情进展顺利,

在几个晚上我已经能够得到一个相当不错的但是价格低于b $ b的功能不足的客户。

有一件小事令我讨厌,虽然我正试图显示这个名字的人的名字

:红色=别人,蓝色=我。

这是我正在添加到QTextBrowser的文本示例:


< font color =''#0000ff''>& lt ; me& gt;< / font>:你好世界


它在我的电脑上就像一个魅力,但在Zaurus上,文字都是黑色的。

有谁知道我怎么解决这个问题?


~~~脑波闪光~~~


我刚才想到了什么:什么如果Z不允许单引号

围绕颜色属性?我试了一下,用以下内容替换了文本




< font color ="#0000ff">& lt; me& gt;< / font>:你好世界


它的确有效!


无论如何,也许这将被其他人拥有相同的

问题。我会坚持在这个小组中,尽可能地从人们那里吸收尽可能多的好的知识;-)


关于我自己的一点点:我24岁,在阿姆斯特丹大学学习计算机科学,我是荷兰人(像Guido ;-)),我现在住了

在阿姆斯特丹。我现在已经是半辈子的程序员:)


Sybren

-

世界的问题是愚蠢的。并不是说应该对愚蠢的死刑进行处罚,但为什么我们不要仅仅拿掉

安全标签来解决问题呢? br />

Hi there!

I''m a beginning Python programmer, and I like it a lot already. Since my
Sharp Zaurus has a fairly complete Python environment including PyQT, I
thought it would be the perfect language for programming some nice
things on my Zaurus. The thing I really missed on the Z was a good
Jabber client. That''s why I''m building my own. Things are going good,
and in a few nights I''ve been able to get a fairly decent though
under-featured client.

There is a small thing annoying me, though I''m trying to show the name
of the person saying something in color: red = someone else, blue = me.
This is an example of the text I''m adding to the QTextBrowser:

<font color=''#0000ff''>&lt;me&gt;</font>: hello world

It works like a charm on my PC, but on the Zaurus the text is all black.
Does anyone know how I can fix this?

~~~ brainwave flash ~~~

I just thought of something: what if the Z doesn''t allow single quotes
around the "color" attribute? I gave it a try, and replaced the text
with:

<font color="#0000ff">&lt;me&gt;</font>: hello world

And it works!

Anyways, perhaps this will be picked up by others having the same
problem. I''ll stick around in this group and try to soak up as many good
knowledge from people as I can ;-)

A bit about myself: I''m a 24 year old, studying Computer Sciences at the
University of Amsterdam, I''m Dutch (like Guido ;-)) and I currently live
in Amsterdam too. I''ve been a programmer for half my life now :)

Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don''t we just take the
safety labels off of everything and let the problem solve itself?

推荐答案

我只想到了一件事:如果Z不允许单引号怎么办? 颜色属性?我试了一下,将文本替换为:

< font color ="#0000ff">& lt; me& gt;< / font>:你好世界

它的确有效!
I just thought of something: what if the Z doesn''t allow single quotes
around the "color" attribute? I gave it a try, and replaced the text
with:

<font color="#0000ff">&lt;me&gt;</font>: hello world

And it works!




非常有趣的东西。有一天,我希望有一个Zaurus或类似的设备来玩具b $ b玩具。无论如何,实际上是主题,适当 HTML(XHTML 1.0,

和HTML 4.0?我不记得......)要求使用双引号

。单引号是非法的。所以,你的Zaurus使用的Qt版本必须要更加严格。


-Tim



Very fun stuff. Someday I hope to have a Zaurus or similar device to
toy with. Anyway, to actually be on topic, "proper" HTML (XHTML 1.0,
and maybe HTML 4.0? I don''t recall...) requires double-quotes to be
used. Single quotes are illegal. So, the Qt version your Zaurus is
using must be a little more strict.

-Tim


Tim Gerla写道:
Tim Gerla wrote:

非常有趣的东西。有一天,我希望有一个Zaurus或类似的设备来玩具。无论如何,实际上是主题,适当 HTML(XHTML 1.0,
和HTML 4.0?我不记得......)需要使用双引号。单引号是非法的。

Very fun stuff. Someday I hope to have a Zaurus or similar device to
toy with. Anyway, to actually be on topic, "proper" HTML (XHTML 1.0,
and maybe HTML 4.0? I don''t recall...) requires double-quotes to be
used. Single quotes are illegal.




你确定吗?当它应该与XML兼容时,它似乎不太可能会使用单引号,而b / b显然允许在属性周围使用单引号或双引号。


我在W3C检查了一两页,但是找不到明显的方法来证明你错了,但我认为责任是在你身上证明

你就在这里。


-Peter



Are you certain about that? It seems very unlikely that it would
outlaw use of single quotes when it is supposed to be XML-compatible,
and XML explicitly allows either single or double quotes around attributes.

I checked a page or two at W3C and couldn''t find an obvious way to
prove that you are wrong, but I think the onus is on you to prove
that you are right here.

-Peter


Tim Gerla写道:
Tim Gerla wrote:
无论如何,实际上是关于主题,正确的HTML(XHTML 1.0,和
可能是HTML 4.0?我不记得......)需要使用双引号。单引号是非法的。
Anyway, to actually be on topic, "proper" HTML (XHTML 1.0, and
maybe HTML 4.0? I don''t recall...) requires double-quotes to be
used. Single quotes are illegal.




XHTML 1.0是XML,它允许单引号和双引号

引号:
http://www.w3.org/TR/REC -xml#NT-AttValue


HTML 4源自SGML,它既支持单个

和双引号,也允许不带引号值,在一些

的情况下:

http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2

< / F>




XHTML 1.0 is XML, which allows both single quotes and double
quotes:

http://www.w3.org/TR/REC-xml#NT-AttValue

HTML 4 is derived from SGML, which also supports both single
and double quotes, and also allows unquoted values, in some
cases:

http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2

</F>



这篇关于PyQT,Sharp Zaurus和QTextBrowser中的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆