0
I made an application in Python 3.6 that calls another script in python to mount a ttk screen. Treeview with database information and that submitted data can be manipulated (change and deletion).
Turns out I can’t leave this ttk screen. Treeview with the permanent focus, since when you press "alt + tab" the focus goes to the previous screen that called this script.
Could someone help me? I tried using "Transient" but I’m not succeeding.
Part of the script that calls the other python script:
def consultacadastro( posi ):
if str(nrbancoget) != "":
a = ConsultaCadastroGeral.Inicio()
Part of the program that displays information ttk. Treeview:
Start of the program
from Tkinter import * from Tkinter import Tk, Button, ttk, Frame, Toplevel, Label, Entry, Stringvar from Tkinter import messagebox from Manager import Manager from Pgmfuncoes import Pgmfuncoes
class Consultacadastrogeral: def Inicio(): root = Tk() root.title("Users Query - General") Customtree(root). pack(expand=1, Fill="Both")
class Customtree(Frame): def init(self, master, *args, **kwargs): Frame.init(self, master, *args, **kwargs)
# Define tamanhos mínimos e máximos da tela
master.minsize( width = 500, height= 200)
master.maxsize( width = 500, height= 200)
self.focus_force()
# Define botão de sair da tela
self.top = Frame(self)
self.edit_button = Button(self.top, text="Sair", font = "bold", fg = "blue", command=master.destroy)
self.edit_button.pack(side="top")
self.top.pack(fill="x")
self.tree = ttk.Treeview(self)
# Define tamanho da coluna
self.tree.column("#0",minwidth=0,width=0)
# Cria barra de rolagem
barra = Scrollbar(self, orient='vertical', command=self.tree.yview)
# Adiciona barra de rolagem
self.tree.configure(yscroll=barra.set)
barra.pack( side = RIGHT, fill=Y )
self.tree["columns"] = ("one", "two", "tree", "four", "five")
self.tree.column("one", width=100, anchor="se")
self.tree.column("two", width=100, anchor="se")
self.tree.column("tree",width=100, anchor="se")
self.tree.column("four",width=100, anchor="se")
self.tree.column("five",width=100, anchor="center")
self.tree.heading("one", text="Número Banco")
self.tree.heading("two", text="Número Agência")
self.tree.heading("tree", text="Conta Corrente")
self.tree.heading("four", text="Saldo Inicial (R$)")
self.tree.heading("five", text="Data Inicial")
"
Thanks in advance.