def __init__(self): Gtk.Window.__init__(self, title="Clipboard Example") table = Gtk.Table(2, 2) self.clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD) self.entry = Gtk.Entry() self.image = Gtk.Image.new_from_icon_name("process-stop", Gtk.IconSize.MENU) button_acept_text = Gtk.Button("Aceptar") button_cancel_text = Gtk.Button("Cancelar") button_close_text = Gtk.Button("Cerrar") #button_copy_image = Gtk.Button("Copy Image") #button_paste_image = Gtk.Button("Paste Image") table.attach(self.entry, 0, 4, 0, 1) #table.attach(self.image, 0, 1, 0, 2) table.attach(button_acept_text, 1, 2, 1, 2) table.attach(button_cancel_text, 2, 3, 1, 2) table.attach(button_close_text, 3, 1, 1, 2) #table.attach(button_copy_image, 1, 2, 1, 2) #table.attach(button_paste_image, 2, 3, 1, 2) button_acept_text.connect("clicked", self.copy_text) button_cancel_text.connect("clicked", self.paste_text) button_close_text.connect("clicked", self.paste_text) #button_copy_image.connect("clicked", self.copy_image) #button_paste_image.connect("clicked", self.paste_image) self.add(table)
def __init__(self): Gtk.Window.__init__(self, title="New Patient Window") Gtk.Window.set_default_size(self, window_w, window_h) # Set Default Window Size patGrid = Gtk.Grid() # Grid Layout Container self.add(patGrid) patGrid.props.valign = Gtk.Align.CENTER patGrid.props.halign = Gtk.Align.CENTER self.firstNameLabel = Gtk.Label("First Name: ") self.firstNameEntry = Gtk.Entry() patGrid.attach(self.firstNameLabel, 1, 1, 2, 2) patGrid.attach_next_to(self.firstNameEntry, self.firstNameLabel, 1, 2, 2) #left=0, r=1, t=2, b=3 self.lastNameLabel = Gtk.Label("Last Name: ") self.lastNameEntry = Gtk.Entry() patGrid.attach_next_to(self.lastNameLabel, self.firstNameLabel, 3, 2, 2) patGrid.attach_next_to(self.lastNameEntry, self.lastNameLabel, 1, 2, 2) self.submitButton = Gtk.Button(label="Submit") self.submitButton.connect("clicked", self.on_submitButton_clicked) patGrid.attach_next_to(self.submitButton, self.lastNameLabel, 3, 4, 2)
def on_newPatButton_clicked(self, widget): """ """ #newPatWin = NewPatientWindow() #newPatWin.show_all() print("New Patient Window") self.labelGrid.remove(self.homePageLabel) self.fakeButton = Gtk.Button("TESTING") self.labelGrid.add(self.fakeButton)
def __init__(self): Gtk.Window.__init__(self, title="Home Window") Gtk.Window.set_default_size(self, window_w, window_h) # Set Default Window Size # FIGURE OUT MENUBAR STUFF... # mb = Gtk.MenuBar(Gtk.Window) # # homeMenuBar = Gtk.Menu() # fileMenu = Gtk.MenuItem("_File") # fileMenu.set_submenu(homeMenuBar) #newPatMenuBar = Gtk.MenuItem("New Patient") #homeMenuBar.append(newPatMenuBar) #fileMenu.append(newPatMenuBar) #openMenuBar = Gtk.MenuItem("Open...") #homeMenuBar.append(openMenuBar) #fileMenu.append(openMenuBar) #endSeshMenuBar = Gtk.MenuItem("End Session") #homeMenuBar.append(endSeshMenuBar) #fileMenu.append(endSeshMenuBar) # mb.append(fileMenu) #Gtk.Application.set_menubar(self, Gtk.MenuBar) box = Gtk.Box(spacing=6) # Box Layout Container self.add(box) # self.box.pack_start(menubar, True,True,0) aboutBox = Gtk.AboutDialog() #gtk_show_about_dialog() self.testButton = Gtk.Button(label="Click Here") self.testButton.connect("clicked", self.on_testButton_clicked) box.pack_start(self.testButton, True, True, 0) self.newPatButton = Gtk.Button(label="New Patient") self.newPatButton.connect("clicked", self.on_newPatButton_clicked) #self.newPatButton.modify_bg(Gtk.StateType.NORMAL, Gdk.Color(6400,6400,6440)) box.pack_start(self.newPatButton, True, True, 0)
def homeWindow(self, widget): """ """ self.homeGrid = Gtk.Grid() # VBox container for label and for buttons self.add(self.homeGrid) self.labelGrid = Gtk.Grid() # Grid for label container self.homePageLabel = Gtk.Label("PUSH ASSIST HOME PAGE") self.labelGrid.add(self.homePageLabel) self.homeGrid.add(self.labelGrid) self.labelGrid.props.halign = Gtk.Align.CENTER # Align center self.labelGrid.props.valign = Gtk.Align.END # Align Center homeButtonGrid = Gtk.Grid() # Grid layout container for buttons self.homeGrid.add(homeButtonGrid) # Add to Vbox container homeButtonGrid.props.halign = Gtk.Align.CENTER # Align center homeButtonGrid.props.valign = Gtk.Align.END # Align botton self.openButton = Gtk.Button( "Open..." ) # Open button... will lead to file selector for past patient files self.openButton.connect( "clicked", self.on_openButton_clicked) # Open button action... homeButtonGrid.attach(self.openButton, 1, 1, 2, 2) # Open button's layout self.newPatButton = Gtk.Button( "New Patient" ) # New patient button leads to new patient window screen self.newPatButton.connect( "clicked", self.on_newPatButton_clicked) # New patient button action... homeButtonGrid.attach_next_to(self.newPatButton, self.openButton, 1, 2, 2) #left=0, r=1, t=2, b=3 self.backButton = Gtk.Button("Back") # Back button self.backButton.connect( "clicked", self.on_backButton_clicked) # Back button action homeButtonGrid.attach_next_to(self.backButton, self.newPatButton, 1, 1, 1) # Back button layout
def __init__(self): Gtk.Window.__init__(self, title="Home Window") Gtk.Window.set_default_size(self, window_w, window_h) # Set Default Window Size # FIGURE OUT MENUBAR STUFF... #menubar = Gtk.MenuBar #Gtk.Application.set_menubar(self, Gtk.MenuBar) self.box = Gtk.Box(spacing=6) # Box Layout Container self.add(self.box) # self.box.pack_start(menubar, True,True,0) self.testButton = Gtk.Button(label="Click Here") self.testButton.connect("clicked", self.on_testButton_clicked) self.box.pack_start(self.testButton, True, True, 0) self.newPatButton = Gtk.Button(label="New Patient") self.newPatButton.connect("clicked", self.on_newPatButton_clicked) self.box.pack_start(self.newPatButton, True, True, 0)
def homeWindow(self, widget): """ """ #self.mainGrid = Gtk.Grid() #self.add(self.mainGrid) self.mainBox = Gtk.VBox() self.add(self.mainBox) self.labelGrid = Gtk.Grid() self.homePageLabel = Gtk.Label("PUSH ASSIST HOME PAGE") self.labelGrid.attach(self.homePageLabel, 1, 1, 2, 2) self.mainBox.add(self.labelGrid) self.labelGrid.props.valign = Gtk.Align.CENTER self.labelGrid.props.halign = Gtk.Align.CENTER # ADDING AND REMOVING SUB GRID WORKS: #self.mainBox.remove(self.labelGrid) #self.mainBox.add(self.labelGrid) self.homeButtonGrid = Gtk.Grid() self.mainBox.add(self.homeButtonGrid) self.homeButtonGrid.props.halign = Gtk.Align.CENTER self.homeButtonGrid.props.valign = Gtk.Align.END self.openButton = Gtk.Button("Open...") self.openButton.connect("clicked", self.on_openButton_clicked) self.homeButtonGrid.attach(self.openButton, 1, 1, 2, 2) self.newPatButton = Gtk.Button("New Patient") self.newPatButton.connect("clicked", self.on_newPatButton_clicked) self.homeButtonGrid.attach_next_to(self.newPatButton, self.openButton, 1, 2, 2) #left=0, r=1, t=2, b=3 self.backButton = Gtk.Button("Back") self.backButton.connect("clicked", self.on_backButton_clicked) self.homeButtonGrid.attach_next_to(self.backButton, self.newPatButton, 1, 1, 1)
def __init__(self): Gtk.Window.__init__(self, title="Home Window") Gtk.Window.set_default_size(self, window_w, window_h) # Set Default Window Size #TODO: FIGURE OUT WINDOW STUFF self.homeVBox = Gtk.VBox() self.add(self.homeVBox) self.labelBox = Gtk.Box() self.homePageLabel = Gtk.Label("PUSH ASSIST HOME PAGE") self.labelBox.add(self.homePageLabel) self.homeVBox.add(self.labelBox) self.labelBox.props.halign = Gtk.Align.CENTER self.labelBox.props.valign = Gtk.Align.END homeButtonGrid = Gtk.Grid() # Grid Layout Container self.homeVBox.add(homeButtonGrid) homeButtonGrid.props.halign = Gtk.Align.CENTER homeButtonGrid.props.valign = Gtk.Align.END # self.box.pack_start(menubar, True,True,0) self.openButton = Gtk.Button("Open...") self.openButton.connect("clicked", self.on_openButton_clicked) homeButtonGrid.attach(self.openButton, 1, 1, 2, 2) self.newPatButton = Gtk.Button("New Patient") self.newPatButton.connect("clicked", self.on_newPatButton_clicked) homeButtonGrid.attach_next_to(self.newPatButton, self.openButton, 1, 2, 2) #left=0, r=1, t=2, b=3 self.backButton = Gtk.Button("Back") self.backButton.connect("clicked", self.on_backButton_clicked) homeButtonGrid.attach_next_to(self.backButton, self.newPatButton, 1, 1, 1)
def test_named_tuple_return(self): from gi.repository import Gtk b = Gtk.Button() b.set_alignment(0.0, 1.0) align = b.get_alignment() # access by name self.assertEqual(len(align), 2) self.assertEqual(align[0], align.xalign) self.assertEqual(align[1], align.yalign) # repr self.assertEqual(repr(align), "(xalign=0.0, yalign=1.0)") # pickle as tuple obj = pickle.dumps(align) self.assertEqual(pickle.loads(obj), (0.0, 1.0))
def __init__(self): Gtk.Window.__init__(self, title="InitialWindow") Gtk.Window.set_default_size(self, window_w, window_h) # Set Default Window Size initGrid = Gtk.Grid() self.add(initGrid) momDisp = Gtk.Box() initGrid.add(momDisp) self.beginButton = Gtk.Button(label="Begin") self.beginButton.connect("clicked", self.on_beginButton_clicked) initGrid.add(self.beginButton) pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale( "pelvisim.png", 100, 100, True) pelvIm = Gtk.Image.new_from_pixbuf(pixbuf) initGrid.add(pelvIm)
def __init__(self): Gtk.Window.__init__(self, title="New Patient Window") Gtk.Window.set_default_size(self, window_w, window_h) # Set Default Window Size self.grid = Gtk.Grid() # Grid Layout Container self.add(self.grid) self.firstNameLabel = Gtk.Label("First Name: ") self.firstNameEntry = Gtk.Entry() self.grid.add(self.firstNameLabel) self.grid.add(self.firstNameEntry) self.lastNameLabel = Gtk.Label("Last Name: ") self.lastNameEntry = Gtk.Entry() self.grid.add(self.lastNameLabel) self.grid.add(self.lastNameEntry) self.submitButton = Gtk.Button(label="Submit") self.submitButton.connect("clicked", self.on_submitButton_clicked) self.grid.add(self.submitButton)
def __init__(self): Gtk.Window.__init__(self, title="Separate PDF") self.button = Gtk.Button(label="Start") self.button.connect("clicked", self.on_button_clicked) self.add(self.button)
import pgi pgi.require_version('Gtk', '3.0') from pgi.repository import Gtk window = Gtk.Window() entry = Gtk.Entry() button_ok = Gtk.Button("OK") button_cancel = Gtk.Button("Cancel") vbox = Gtk.VBox() vbox.pack_start(entry) hbox = Gtk.HBox() hbox.pack_start(button_ok) hbox.pack_start(button_cancel) vbox.pack_start(hbox) window.add(vbox) window.show_all()
msg_dialog.run() msg_dialog.destroy() except ValueError: msg_dialog.run() msg_dialog.destroy() win = Gtk.Window() win.set_position(Gtk.WindowPosition.CENTER) win.set_title("Классификация сигналов ЭМГ") win.set_default_size(p.main_window_width, p.main_window_height) win.timeout_id = None win.connect("delete-event", Gtk.main_quit) file_chooser_button = Gtk.Button("Выбрать файл") file_chooser_button.connect("clicked", choose_file) # configs = {'100% - 0,1,3': [1, 0.07, 0.47, "0,1,3"], # '94.94% - 0,1,4,5,6':[2, 0.02, 0.35, "0,1,4,5,6"], # '96.50% - 0,1,3,4,5':[2, 0.04, 0.64, "0,1,3,4,5"]} # config_combo = Gtk.ComboBoxText() # config_combo.set_entry_text_column(0) # config_combo.connect("changed", on_config_combo_changed) # for key, value in configs.items(): # config_combo.append_text(str(key)) # config_combo.set_sensitive(False) c_label = Gtk.Label(label="C: ") c_label.set_alignment(0, 0.5) gamma_label = Gtk.Label(label="Gamma: ")