Take off or move a frame in Tkinter(python)?

Asked

Viewed 912 times

0

I have a problem in python code that is the following, type I want to move the frame of the entry checkbutton so I can not, if you can help me, run the code there for you to understand the problem.

`from Tkinter import * from sqlite3 import *

create class(Object): def init(self, main):

frames and frame packaging

    self.font = ('Arial', '18', 'bold')
    self.frame1 = Frame(principal)
    self.frame1.place()
    self.frame1.pack()
    self.frame1['bg'] = '#B5B5B5'
    self.frame2 = Frame(principal)
    self.frame2.place()
    self.frame2.pack()
    self.frame2['bg'] = '#B5B5B5'

screen text

    L1 = Label(self.frame1, font = self.font, text = "  Nome do Seu Banco de Dado  ", bg = '#B5B5B5')

    L1.pack()
    E1 = Entry(self.frame1, bd = 5, highlightcolor = '#1E90FF')

    E1.pack()

checkButtons

    self.nome = Checkbutton(self.frame2, bd = 5, text = 'Nome', variable = Vnome)
    self.nome.place()
    self.nome.pack(side = LEFT)
    Vnome.get()
    self.cor = Checkbutton(self.frame2, bd = 5, text = 'Cor', variable = Vcor)
    self.cor.pack(side = LEFT)
    Vcor.get()
    self.cpf = Checkbutton(self.frame2, bd = 5, text = 'CPF', variable = Vcpf)
    self.cpf.pack(side = LEFT)
    Vcpf.get()
    self.email = Checkbutton(self.frame2, bd = 5, text = 'Email', variable = Vemail)
    self.email.pack(side = LEFT)
    Vemail.get()

main = Tk()

variables of checkButtons methods

Vnome = Intvar() Vcor = Intvar() Vcpf = Intvar() Vemail = Intvar()

creates the instance

create(main) main['bg'] = '#B5B5B5' background = Photoimage('Blue') main.Geometry('400x300') main.title("Registration Manager") mainloop.()`

1 answer

0


Amid self.frame1['bg'] = '#B5B5B5' and self.frame2 = Frame(principal)

put this:

self.frame3 = Frame(principal) # Crio um terceiro frame que ficará entre o 1 e o 2
self.frame3.pack()

Label(self.frame3).pack() # Crio um Label vazio, só para afastar

being like this:

    self.font = ('Arial', '18', 'bold')
    self.frame1 = Frame(principal)
    self.frame1.place()
    self.frame1.pack()
    self.frame1['bg'] = '#B5B5B5'

    self.frame3 = Frame(principal) # Crio um terceiro frame que ficará entre o 1 e o 2
    self.frame3.pack()

    Label(self.frame3).pack() # Crio um Label vazio, só para afastar

    self.frame2 = Frame(principal)
    self.frame2.place()
    self.frame2.pack()
    self.frame2['bg'] = '#B5B5B5'

Upshot:

Resultado final

Browser other questions tagged

You are not signed in. Login or sign up in order to post.