* [devel] pygtk2 - parent of widget
@ 2004-02-17 13:33 Vitaly Ostanin
2004-02-17 13:41 ` Sergey Pinaev
0 siblings, 1 reply; 4+ messages in thread
From: Vitaly Ostanin @ 2004-02-17 13:33 UTC (permalink / raw)
To: ALT Devel discussion list
[-- Attachment #1.1: Type: text/plain, Size: 633 bytes --]
Hello, All!
Расскажите, pls, как можно получить родителя виджета в pygtk2 ?
Либо я пошёл совсем не тем путём, либо pygtk2tutorial писал очень
скрытный человек :) Там есть пример класса с gtk.FileSelection с
работающей обработкой кнопки "Ok".
В аттаче тестовая программа, где я пытался по нажатию "Ok"
получать имя файла, но не в классе. Проблема в том, что
filesel.ok_button.connect("clicked", gtk_file_open_ok)
передаёт в качестве виджета кнопку, а не диалог, и я не знаю, как
с этим бороться.
Если кто заинтересуется, диалог открывается через меню File/Open.
--
Regards, Vyt
mailto: vyt@vzljot.ru
JID: vyt@vzljot.ru
[-- Attachment #1.2: pix.tar.bz2 --]
[-- Type: application/x-bzip, Size: 1592 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 256 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [devel] pygtk2 - parent of widget
2004-02-17 13:33 [devel] pygtk2 - parent of widget Vitaly Ostanin
@ 2004-02-17 13:41 ` Sergey Pinaev
2004-02-17 14:30 ` [devel] " Vitaly Ostanin
0 siblings, 1 reply; 4+ messages in thread
From: Sergey Pinaev @ 2004-02-17 13:41 UTC (permalink / raw)
To: ALT Devel discussion list
hi.
On Tue, 17 Feb 2004 16:33:19 +0300
Vitaly Ostanin <vyt@vzljot.ru> wrote:
VO> В аттаче тестовая программа, где я пытался по нажатию "Ok"
VO> получать имя файла, но не в классе. Проблема в том, что
VO> filesel.ok_button.connect("clicked", gtk_file_open_ok)
VO> передаёт в качестве виджета кнопку, а не диалог, и я не знаю, как
VO> с этим бороться.
--- pix.py.old 2004-02-17 16:14:47 +0300
+++ pix.py 2004-02-17 16:40:17 +0300
@@ -15,13 +15,13 @@
def gtk_main_quit(*args):
gtk.main_quit()
-def gtk_file_open_ok(widget):
- filename = widget.get_filename()
+def gtk_file_open_ok(widget, filesel):
+ filename = filesel.get_filename()
print filename
def gtk_file_open(*args):
filesel = gtk.FileSelection("File selection")
- filesel.ok_button.connect("clicked", gtk_file_open_ok)
+ filesel.ok_button.connect("clicked", gtk_file_open_ok, filesel)
filesel.show()
xml.signal_autoconnect(locals())
--
mail="Sergey Pinaev <dfo@antex.ru>"
url="http://`echo $mail | sed 's/.* <\(.*\)>/\1/' | sed 's/@/./'`"
^ permalink raw reply [flat|nested] 4+ messages in thread
* [devel] Re: pygtk2 - parent of widget
2004-02-17 13:41 ` Sergey Pinaev
@ 2004-02-17 14:30 ` Vitaly Ostanin
0 siblings, 1 reply; 4+ messages in thread
From: Vitaly Ostanin @ 2004-02-17 14:30 UTC (permalink / raw)
To: ALT Devel discussion list
[-- Attachment #1: Type: text/plain, Size: 1170 bytes --]
Sergey Pinaev wrote:
> hi.
> On Tue, 17 Feb 2004 16:33:19 +0300
> Vitaly Ostanin <vyt@vzljot.ru> wrote:
>
> VO> В аттаче тестовая программа, где я пытался по нажатию "Ok"
> VO> получать имя файла, но не в классе. Проблема в том, что
> VO> filesel.ok_button.connect("clicked", gtk_file_open_ok)
> VO> передаёт в качестве виджета кнопку, а не диалог, и я не знаю, как
> VO> с этим бороться.
>
> --- pix.py.old 2004-02-17 16:14:47 +0300
> +++ pix.py 2004-02-17 16:40:17 +0300
> @@ -15,13 +15,13 @@
> def gtk_main_quit(*args):
> gtk.main_quit()
>
> -def gtk_file_open_ok(widget):
> - filename = widget.get_filename()
> +def gtk_file_open_ok(widget, filesel):
> + filename = filesel.get_filename()
> print filename
>
> def gtk_file_open(*args):
> filesel = gtk.FileSelection("File selection")
> - filesel.ok_button.connect("clicked", gtk_file_open_ok)
> + filesel.ok_button.connect("clicked", gtk_file_open_ok, filesel)
> filesel.show()
>
> xml.signal_autoconnect(locals())
Огроменное спасибо! Теперь gpointer user_data перестал для меня
быть абстрактным :)
--
Regards, Vyt
mailto: vyt@vzljot.ru
JID: vyt@vzljot.ru
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 256 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* [devel] Re: pygtk2 - parent of widget
@ 2004-02-17 15:23 ` Vitaly Ostanin
0 siblings, 0 replies; 4+ messages in thread
From: Vitaly Ostanin @ 2004-02-17 15:23 UTC (permalink / raw)
To: ALT Devel discussion list
[-- Attachment #1: Type: text/plain, Size: 866 bytes --]
Vital Khilko wrote:
> On Аўт, 2004-02-17 at 16:30, Vitaly Ostanin wrote:
<skipped/>
>>> def gtk_file_open(*args):
>>> filesel = gtk.FileSelection("File selection")
>>> - filesel.ok_button.connect("clicked", gtk_file_open_ok)
>>> + filesel.ok_button.connect("clicked", gtk_file_open_ok, filesel)
>>> filesel.show()
>>>
>>> xml.signal_autoconnect(locals())
>>
>>Огроменное спасибо! Теперь gpointer user_data перестал для меня
>>быть абстрактным :)/
>>
> Кстати, по-мойму тут и clicked лучше заменить на pressed
Тогда будет нестандартным поведение диалога - реакция должна быть
после отпускания кнопки.
<skipped/>
--
Regards, Vyt
mailto: vyt@vzljot.ru
JID: vyt@vzljot.ru
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 256 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-02-17 15:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-17 13:33 [devel] pygtk2 - parent of widget Vitaly Ostanin
2004-02-17 13:41 ` Sergey Pinaev
2004-02-17 14:30 ` [devel] " Vitaly Ostanin
2004-02-17 15:23 ` Vitaly Ostanin
ALT Linux Team development discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
public-inbox-index devel
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.devel
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git