0
親ウィンドウを移動している最中でも親ウィンドウを中心にして環境設定のポップアップを維持する方法を教えてもらえますか?ありがとう:)ここポップアップウィンドウを親に集中させる - Glade、GTK、Python
親ウィンドウを移動している最中でも親ウィンドウを中心にして環境設定のポップアップを維持する方法を教えてもらえますか?ありがとう:)ここポップアップウィンドウを親に集中させる - Glade、GTK、Python
は非常に単純な例で、好みのウィンドウを中心にして移動させながら、それは親にも移動します(ただし、ウィンドウマネージャに依存します):
に結果のimport gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
class AppWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title="Python Example")
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL,spacing=6)
self.add(box)
button1 = Gtk.Button("Information")
button1.connect("clicked", self.on_button_clicked)
box.add(button1)
treeview = Gtk.TreeView()
treeview.set_size_request(640,480)
box.add(treeview)
def on_button_clicked(self, widget):
preferences_window = Gtk.Window (Gtk.WindowType.TOPLEVEL)
preferences_window.set_title ("Preferences Window")
preferences_window.set_modal (True)
preferences_window.set_position(Gtk.WindowPosition.CENTER_ON_PARENT)
preferences_window.set_transient_for(self)
preferences_window.show_all()
preferences_window.connect("delete-event", preferences_window.destroy);
win = AppWindow()
win.connect("delete-event", Gtk.main_quit)
win.show_all()
Gtk.main()