小编Ten*_*eej的帖子

Python 3.3中的现代GUI编程

我正在整理一些程序,现在是开始为其中一些程序制作GUI的时候了.该代码目前是用Python 3.3编写的.

我研究了一些Python的GUI,即Tkinter,wxPython和PyGTK.我发现的一切似乎只是创建看起来相当陈旧的GUI.我已经创建了几个示例GUI,它们都可以工作,它们看起来非常像Windows 95.

我发现/创建的一个例子: http://python.6.x6.nabble.com/file/n4545517/MLDataAnalyzer5.png

我想要的一个例子是: http://images.six.betanews.com/screenshots/1237236321-1.jpg

它只是一个关于GUI如何工作的高级知识,还是只有更适合"现代"外观GUI的GUI模块?

如果它是关于GUI如何工作的高级知识,是否有一些关于如何使GUI看起来更"现代"的教程.

提前致谢.

user-interface pygtk wxpython tkinter python-3.3

16
推荐指数
1
解决办法
3万
查看次数

任务列表输出

我对python很新,但我无法找到我认为应该是一个相对简单的问题的答案.

我正在尝试利用tasklist,我想知道我能用它的输出做什么(比如将它设置为变量,数组,类似的东西).

我正在使用Python 3.3,我在查找文档方面遇到了一些麻烦3.3.

代码相对简单:

import os
os.system("tasklist")
input()
Run Code Online (Sandbox Code Playgroud)

这会打印任务列表,但是我无法将该打印中的数据转换为变量.我假设它与Python有关,而与tasklist无关.

最终,我希望制作一个任务列表条目的矩阵,这样我就可以搜索一个进程,并获取相应的数据.

python tasklist python-3.x

3
推荐指数
3
解决办法
1万
查看次数

基于百分比的Android布局

我试图围绕Android布局,我想我会从一个简单的例子开始,但由于某种原因它不起作用.

我开始只是将布局划分为4个块,并使用背景颜色来证明它按预期工作.

这段代码很适合:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:orientation="vertical"
    android:layout_height="match_parent">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="0dip"
        android:layout_weight="0.25"
        android:background="@android:color/holo_green_light">
    </RelativeLayout>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="0dip"
        android:layout_weight="0.25"
        android:background="@android:color/white">
    </RelativeLayout>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="0dip"
        android:layout_weight="0.25"
        android:background="@android:color/holo_orange_light">
    </RelativeLayout>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="0dip"
        android:layout_weight="0.25"
        android:background="@android:color/holo_red_light">
    </RelativeLayout>

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

因此,我希望继续细分这些部分,并在第二部分上添加两个新布局,每个布局填充50%(有效地覆盖它).

我已尝试过LinearLayout和RelativeLayout,但我无法使用任何东西.

这是我现在的代码:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:orientation="vertical"
    android:layout_height="match_parent">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="0dip"
        android:layout_weight="0.25"
        android:background="@android:color/holo_green_light">
    </RelativeLayout>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="0dip"
        android:layout_weight="0.25"
        android:orientation="horizontal" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="0.5"
            android:background="@android:color/holo_green_dark"
            android:layout_alignParentLeft="true" >
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="0.5"
            android:background="@android:color/holo_blue_dark"
            android:layout_alignParentRight="true" >
        </LinearLayout>

    </RelativeLayout>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="0dip"
        android:layout_weight="0.25" …
Run Code Online (Sandbox Code Playgroud)

android android-layout

2
推荐指数
1
解决办法
148
查看次数

使用带有赋值的`和`

我希望以下评估(a < b)以及(b < c)返回no.

a = 1
b = 4
c = 3
@test = (a < b) and (b < c)
if @test
  puts "yes"
else
  puts "no"
end
Run Code Online (Sandbox Code Playgroud)

我没有得到我期望的行为.它返回yes并且似乎仅评估(a < b)而不是(b < c).我认为问题在于and.

ruby operator-precedence logical-operators

1
推荐指数
1
解决办法
52
查看次数