我有一个Gtk.ComboBoxText,它应该用作触发器来激活Gtk.TreeView中的行。我知道如何通过激活树视图中各自的行来触发组合框。反之亦然,这超出了我的范围。我了解到我需要将Gtk.TreePath和Gtk.TreeViewColumn传递给函数row_activated(),但是我不知道如何正确地实现这些,也不知道如何将行ID放在函数self.combo_changed()中。这就是这个问题的一个例子:
from gi.repository import Gtk
class MainWindow(Gtk.Window):
def __init__(self):
我正在我的一个应用程序中使用gtk treeview。
应用程序的工作方式如下:我从日志文件中提取一些数据,并将重要的数据添加到我的splite数据库中,然后,我通过从数据库中获取行来在treeview中显示数据。
现在我的问题是如何添加换行符,以便可以在treeview can渲染器中添加多行。
我通过设置cellrenderer "markup“属性进行了尝试,然后尝试添加"\n”,然后使用
标签。在"\n“的情况下,它打印"\n”,就像它在treeview单元格中一样。如果我尝试添加下面的错误
标签。
GtkWarning: Failed to set t
我这里有一个Gtk.TreeView。大多数但不是所有的项目都应该能够被拖放。在本例中,第一项应该是,而不是,可以被拖放,但是应该是可选择的。
我怎么能意识到这一点?也许我必须使用drag-begin信号并停止拖曳在那里。但我不知道怎么做。
#!/usr/bin/env python3
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from gi.repository import Gdk
class MainWindow(Gtk.Window):
de
我有一个按钮,我想让所选行闪烁。有人应该单击闪烁按钮,然后单击event to_blinkstart a Thread _blink,这会更改MyTreeStore中3-6个str元素的值。 import threading
import time
class MyTreeStore(Gtk.TreeStore):
def __init__(self):
# i use the 3 last str's for the background colors
Gtk.TreeStore.__init__(self, str, str, str,
我正在尝试让拖放在pygobject中很好地工作,但它很慢,没有反应,90%的时间我必须挥动我正在拖拽的项目才能成功地放下它,有人能看到我做得不正确吗,或者这是pygobject的bug?以下是我的代码
from gi.repository import Gtk, GdkPixbuf, Gdk
import os
def got_data_cb(windowid, context, x, y, data, info, time):
# Got data.
tempArray = data.get_text().splitlines()
for i in tempArray:
i =
我希望找到在运行时在ruby脚本中创建的类的列表/总结。
我做这个
# rewrite class in order to display ClassName when GCed"
#
$objs = []
class Class
alias oldNew new
def new(*args)
inst = oldNew(*args)
$objs << inst.class.name unless $objs.include?(inst.class.name)
inst
end
end
# some code
puts $bjs
有更
大家好,
我在玩一体式开发,并使用gtk作为窗口。现在我使用的是Windows7 x64。
我遇到的问题是,当我最大化窗口时(通过手工或程序,这并不重要),页面顶部仍然有一些空间。屏幕底部的连接也不太好。所以看起来整个程序都是最大化的,然后放下几个像素。
下面是最大化窗口的屏幕截图:
正如您在第二屏幕上所看到的那样,将程序放在最上面是可以实现的:
所以我的问题很简单。我怎样才能让窗户以正常的方式最大化.
编辑 MainWindow.cs中的代码(root/gui/MainWindow.cs)
// This file has been generated by the GUI de
我对python很陌生,我放置了一个按钮来刷新listview并从.txt文件中获取信息,但是它不起作用:
以下是代码:
import gtk
actresses = [i.strip().replace("'", "").split() for i in open("lista.txt").readlines()]
class PyApp(gtk.Window):
def __init__(self):
super(PyApp, self).__init__()
self.set_si
我在ui中添加了一个Gtk.InfoBar,一切看起来都很好。在Glade中,我可以将Infobar切换到Infobar,反之亦然。
在上,允许的方法中列出了set_revealed。
公开无效set_revealed (bool披露)
将GtkInfoBar:属性设置为property。
但是当我构建我的项目时,我增强了error: The name 'set_revealed' does not exist in the context of'Gtk.InfoBar'
我做错了什么?
这是我的密码:
namespace Zeiterfassunggt
我无法让gtk的单元格渲染器组合框显示任何选项。我需要为树中的每一行使用不同的模型,使用应该可以做到这一点。我的结果是组合框渲染器是完全空的。
下面是一个简化的示例:
{-# OPTIONS_GHC -Wall #-}
module Main ( main ) where
import Graphics.UI.Gtk ( AttrOp( (:=) ) )
import qualified Graphics.UI.Gtk as Gtk
import System.Glib.Signals ( on )
-- the element in the list store
data ListEl
我将TreeView gtk2工具提示翻译成Gtk3,它几乎正在运行,但我在管理工具提示窗口的坐标时遇到了问题。
我希望工具提示窗口位于鼠标附近,然后跟随它靠近。而不是我的项目,工具提示窗口位于屏幕的一角
我的代码是
#!/usr/bin/env python
# coding: utf-8
'''
warning data not update !!!!!!!!!!!!!
TreeViewTooltips.py
Provides TreeViewTooltips, a class which presents tooltips for cells,
colum