I made an application in Python 3.6 that calls another python script to mount a ttk.Treeview screen with the database information and this presented data can be manipulated (change and delete).
It turns out that I can not leave this ttk.Treeview screen with the permanent focus, since when the "alt + tab" key focus changes to the previous screen that called this script.
Can anyone help me? I tried to use 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 the information ttk.Treeview:
Starting 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 GeneralCountryReview: def Home (): root = Tk () root.title ("Users Query - General") CustomTree (root) .pack (expand = 1, fill="both")
class CustomTree (Frame): def init (self, master, * args, ** kwargs): 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")
"
Thank you in advance.