def set_layout(self, background, dimensions, transparency): w, h, x, y = dimensions self.width = Spinbox(self, background='#defffc', foreground='#435661', from_=0, to_=10000, justify='center', highlightthickness=0, increment=1, command=self._apply) self.width.place(relx=0.0725, rely=0.075, relwidth=0.3325, relheight=0.0325, anchor='nw') self.height = Spinbox(self, background='#defffc', foreground='#435661', from_=0, to_=10000, justify='center', highlightthickness=0, increment=1, command=self._apply) self.height.place(relx=0.5825, rely=0.075, relwidth=0.3425, relheight=0.033, anchor='nw') self.xoff = Spinbox(self, background='#defffc', foreground='#435661', from_=0, to_=10000, justify='center', highlightthickness=0, increment=1, command=self._apply) self.xoff.place(relx=0.069, rely=0.186, relwidth=0.333, relheight=0.0325, anchor='nw') self.yoff = Spinbox(self, background='#defffc', foreground='#435661', from_=0, to_=10000, justify='center', highlightthickness=0, increment=1, command=self._apply) self.yoff.place(relx=0.582, rely=0.186, relwidth=0.343, relheight=0.033, anchor='nw') Label(self, background='#435661', foreground='#defffc', text='width') \ .place(relx=0.103, rely=0.048, relwidth=0.27, relheight=0.0275, anchor='nw') Label(self, background='#435661', foreground='#defffc', text='height') \ .place(relx=0.63, rely=0.05, relwidth=0.25, relheight=0.025, anchor='nw') Label(self, background='#435661', foreground='#defffc', text='x offset') \ .place(relx=0.135, rely=0.161, relwidth=0.2025, relheight=0.025, anchor='nw') Label(self, background='#435661', foreground='#defffc', text='y offset') \ .place(relx=0.635, rely=0.16, relwidth=0.23, relheight=0.02625, anchor='nw') self.current_dim = myButton(self, text="Set current root's dimensions", command=lambda *args: self.set_current()) self.current_dim.place(relx=0.175, rely=0.2537, relwidth=0.65, relheight=0.035, anchor='nw') self.transparency = Spinbox(self, background='#defffc', foreground='#435661', from_=0, to_=1, justify='center', highlightthickness=0, increment=0.01, command=self._apply) self.transparency.place(relx=0.3, rely=0.36, relwidth=0.4, relheight=0.03375, anchor='nw') Label(self, background='#435661', foreground='#defffc', text='transparency') \ .place(relx=0.324, rely=0.335, relwidth=0.34, relheight=0.025, anchor='nw') self.entry = Entry(self, borderwidth=0, background='#557282', foreground='#defffc', highlightthickness=0, justify="center") self.entry.place(relx=0.3, rely=0.4725, relwidth=0.4, relheight=0.04625, anchor='nw') Label(self, background='#435661', foreground='#defffc', text='background') \ .place(relx=0.375, rely=0.449, relwidth=0.2525, relheight=0.02375, anchor='nw') self.apply = myButton(self, text="Apply", command=lambda *args: self._apply()) self.apply.place(relx=0.23, rely=0.6075, relwidth=0.54, relheight=0.05125, anchor='nw') self.confirm = myButton(self, text="CONFIRM", command=lambda *args: self._confirm()) self.confirm.place(relx=0.23, rely=0.7762, relwidth=0.54, relheight=0.09125, anchor='nw') self.width.delete(0, "end") self.height.delete(0, "end") self.xoff.delete(0, "end") self.yoff.delete(0, "end") self.width.insert("end", w) self.height.insert("end", h) self.xoff.insert("end", x) self.yoff.insert("end", y) self.transparency.delete(0, "end") self.transparency.insert("end", transparency) self.width.bind("<Return>", lambda *args: self._apply()) self.height.bind("<Return>", lambda *args: self._apply()) self.xoff.bind("<Return>", lambda *args: self._apply()) self.yoff.bind("<Return>", lambda *args: self._apply()) self.transparency.bind("<Return>", lambda *args: self._apply()) self.entry.insert("end", background)
def set_layout(self): # self-explanatory Label(self, background='#435661', text='relx:', foreground='#defffc') \ .place(relx=0.145, rely=0.0125, relwidth=0.1625, relheight=0.025, anchor='nw') Label(self, background='#435661', foreground='#defffc', text='rely:') \ .place(relx=0.6845, rely=0.0135, relwidth=0.155, relheight=0.0225, anchor='nw') Label(self, background='#435661', text='relwidth:', foreground='#defffc') \ .place(relx=0.044, rely=0.089, relwidth=0.37, relheight=0.02125, anchor='nw') Label(self, background='#435661', foreground='#defffc', text='relheight:') \ .place(relx=0.667, rely=0.0875, relwidth=0.195, relheight=0.02375, anchor='nw') self.spin_relx = Spinbox(self, readonlybackground='#defffc', highlightthickness=0, foreground='#435661', from_=0, command=self.mod, to_=1, increment=0.001, justify='center') self.spin_relx.place(relx=0.085, rely=0.0425, relwidth=0.295, relheight=0.03375, anchor='nw') self.spin_rely = Spinbox(self, readonlybackground='#defffc', foreground='#435661', justify='center', highlightthickness=0, command=self.mod, from_=0, to_=1, increment=0.001) self.spin_rely.place(relx=0.6135, rely=0.0425, relwidth=0.3005, relheight=0.03375, anchor='nw') self.spin_relw = Spinbox(self, readonlybackground='#defffc', foreground='#435661', justify='center', highlightthickness=0, command=self.mod, from_=0, to_=1, increment=0.001) self.spin_relw.place(relx=0.084, rely=0.1175, relwidth=0.295, relheight=0.035, anchor='nw') self.spin_relh = Spinbox(self, readonlybackground='#defffc', foreground='#435661', justify='center', highlightthickness=0, command=self.mod, from_=0, to_=1, increment=0.001) self.spin_relh.place(relx=0.6115, rely=0.1177, relwidth=0.304, relheight=0.035, anchor='nw') self.label_arguments = Label(self, background='#557282', foreground='#defffc') self.label_arguments.place(relx=0.086, rely=0.1832, relwidth=0.8305, relheight=0.06125, anchor='nw') self.entry_arguments = Entry(self, background='#defffc', foreground='#435661', justify='center') self.entry_arguments.place(relx=0.22, rely=0.2625, relwidth=0.545, relheight=0.04375, anchor='nw') self.listbox = Listbox(self, background='#557282', foreground='#defffc', borderwidth=0) self.listbox.place(relx=0.085, rely=0.3275, relwidth=0.83, relheight=0.4062, anchor='nw') myButton(self, command=lambda *a: self.set_value(), text='OK') \ .place(relx=0.8245, rely=0.2672, relwidth=0.13, relheight=0.0355, anchor='nw') Label(self, background='#435661', foreground='#defffc', text='Name:', anchor='w') \ .place(relx=0.083, rely=0.766, relwidth=0.1205, relheight=0.035, anchor='nw') self.entry_name = Entry(self, background='#defffc', foreground='#435661', justify='center') self.entry_name.place(relx=0.245, rely=0.7662, relwidth=0.5225, relheight=0.035, anchor='nw') myButton(self, command=lambda *a: self.confirm(), text='CONFIRM') \ .place(relx=0.201, rely=0.8575, relwidth=0.6155, relheight=0.0825, anchor='nw')
def __init__(self, master, **kwargs): super().__init__(master, **kwargs) self.master = master self.bg = self["bg"] self.pack_propagate(0) root_button = myButton( self, text="SET ROOT", command=lambda *args: self.event_generate("<<SETROOT>>")) root_button.place(relx=0.1, rely=0.031, relwidth=0.8, relheight=0.0775, anchor='nw') frame_button = myButton( self, text="FRAME", command=lambda *args: self.event_generate("<<FRAME>>")) frame_button.place(relx=0.101, rely=0.1395, relwidth=0.363, relheight=0.1, anchor='nw') label_button = myButton( self, text="LABEL", command=lambda *args: self.event_generate("<<LABEL>>")) label_button.place(relx=0.1005, rely=0.2662, relwidth=0.364, relheight=0.1, anchor='nw') button_button = myButton( self, text="BUTTON", command=lambda *args: self.event_generate("<<BUTTON>>")) button_button.place(relx=0.536, rely=0.14, relwidth=0.365, relheight=0.1, anchor='nw') radio_button = myButton( self, text="RADIOBUTTON", command=lambda *args: self.event_generate("<<RADIOBUTTON>>")) radio_button.place(relx=0.5335, rely=0.2657, relwidth=0.365, relheight=0.1, anchor='nw') check_button = myButton( self, text="CHECKBUTTON", command=lambda *args: self.event_generate("<<CHECKBUTTON>>")) check_button.place(relx=0.1005, rely=0.391, relwidth=0.364, relheight=0.1, anchor='nw') combobox_button = myButton( self, text="COMBOBOX", command=lambda *args: self.event_generate("<<COMBOBOX>>")) combobox_button.place(relx=0.1005, rely=0.516, relwidth=0.364, relheight=0.1, anchor='nw') entry_button = myButton( self, text="ENTRY", command=lambda *args: self.event_generate("<<ENTRY>>")) entry_button.place(relx=0.536, rely=0.3907, relwidth=0.363, relheight=0.1, anchor='nw') text_button = myButton( self, text="TEXT", command=lambda *args: self.event_generate("<<TEXT>>")) text_button.place(relx=0.536, rely=0.5158, relwidth=0.363, relheight=0.1, anchor='nw') spinbox_button = myButton( self, text="SPINBOX", command=lambda *args: self.event_generate("<<SPINBOX>>")) spinbox_button.place(relx=0.1005, rely=0.642, relwidth=0.364, relheight=0.1, anchor='nw') listbox_button = myButton( self, text="LISTBOX", command=lambda *args: self.event_generate("<<LISTBOX>>")) listbox_button.place(relx=0.536, rely=0.6428, relwidth=0.365, relheight=0.1, anchor='nw') self.save_button = myButton(self, text="SAVE", command=self.save) self.save_button.place(relx=0.22, rely=0.8125, relwidth=0.56, relheight=0.1225, anchor='nw')
def set_everything(self): self.create_all_colors_img() self.all_colors = Label(self, image=self.all_colors_img, bg="#435661") self.all_colors.place(relx=0.025, rely=0.012, relwidth=0.95, relheight=0.07, anchor='nw') self.quad = Label(self, bg="#557282") self.quad.place(relx=0.025, rely=0.093, relwidth=0.95, relheight=0.475, anchor='nw') self.circle = Canvas(self, highlightthickness=0, bg="#435661") self.circle.place(relx=0.025, rely=0.582, relwidth=0.334, relheight=0.167, anchor='nw') self.circle.create_oval((0, 0, 66, 66), width=2, fill=self.color, outline="#435661") self.entry = Entry(self, bd=0, highlightthickness=0, bg="#557282", fg="#defffc", justify="center") self.entry.place(relx=0.4, rely=0.63, relwidth=0.57, relheight=0.08) if self.color != "#557282": self.entry.insert("end", self.color) self.ok = myButton(self, text="Confirm", font=("", 15), command=lambda *args: self.confirm()) self.ok.place(relx=0.21, rely=0.784, relwidth=0.58, relheight=0.08, anchor='nw') self.remove = myButton(self, text="Remove this color", font=("", 12), command=lambda *args: self.remove_()) self.remove.place(relx=0.21, rely=0.891, relwidth=0.58, relheight=0.08, anchor='nw') self.all_colors.bind("<Button-1>", lambda event: self.set_color_picked(event.x)) self.all_colors.bind("<ButtonRelease-1>", lambda event: self.show_gradient()) self.all_colors.bind("<B1-Motion>", lambda event: self.set_color_picked(event.x)) self.all_colors.bind("<B1-Motion>", lambda event: self.show_gradient(event.x)) self.quad.bind("<Button-1>", lambda event: self.show_color(event.x, event.y)) self.quad.bind("<B1-Motion>", lambda event: self.show_color(event.x, event.y)) self.entry.bind("<Return>", lambda *args: self.entry_sets())
def __init__(self, master): super().__init__(master, bg='#435661') master.geometry('200x400+50+100') master.title("") self.record = [None for _ in range(32)] self.b11 = myButton(self, text=" + ", font=("", 32), command=lambda *args: self.clicked(0)) self.b11.place(relx=0.025, rely=0.012, relwidth=0.215, relheight=0.108, anchor='nw') self.b12 = myButton(self, text=" + ", font=("", 32), command=lambda *args: self.clicked(1)) self.b12.place(relx=0.27, rely=0.012, relwidth=0.215, relheight=0.108, anchor='nw') self.b13 = myButton(self, text=" + ", font=("", 32), command=lambda *args: self.clicked(2)) self.b13.place(relx=0.515, rely=0.012, relwidth=0.215, relheight=0.108, anchor='nw') self.b14 = myButton(self, text=" + ", font=("", 32), command=lambda *args: self.clicked(3)) self.b14.place(relx=0.758, rely=0.012, relwidth=0.215, relheight=0.108, anchor='nw') self.b21 = myButton(self, text=" + ", font=("", 32), command=lambda *args: self.clicked(4)) self.b21.place(relx=0.025, rely=0.135, relwidth=0.215, relheight=0.108, anchor='nw') self.b22 = myButton(self, text=" + ", font=("", 32), command=lambda *args: self.clicked(5)) self.b22.place(relx=0.271, rely=0.135, relwidth=0.215, relheight=0.108, anchor='nw') self.b23 = myButton(self, text=" + ", font=("", 32), command=lambda *args: self.clicked(6)) self.b23.place(relx=0.517, rely=0.135, relwidth=0.215, relheight=0.108, anchor='nw') self.b24 = myButton(self, text=" + ", font=("", 32), command=lambda *args: self.clicked(7)) self.b24.place(relx=0.761, rely=0.136, relwidth=0.215, relheight=0.108, anchor='nw') self.b31 = myButton(self, text=" + ", font=("", 32), command=lambda *args: self.clicked(8)) self.b31.place(relx=0.025, rely=0.258, relwidth=0.215, relheight=0.108, anchor='nw') self.b32 = myButton(self, text=" + ", font=("", 32), command=lambda *args: self.clicked(9)) self.b32.place(relx=0.27, rely=0.258, relwidth=0.215, relheight=0.108, anchor='nw') self.b33 = myButton(self, text=" + ", font=("", 32), command=lambda *args: self.clicked(10)) self.b33.place(relx=0.517, rely=0.258, relwidth=0.215, relheight=0.108, anchor='nw') self.b34 = myButton(self, text=" + ", font=("", 32), command=lambda *args: self.clicked(11)) self.b34.place(relx=0.759, rely=0.258, relwidth=0.215, relheight=0.108, anchor='nw') self.b41 = myButton(self, text=" + ", font=("", 32), command=lambda *args: self.clicked(12)) self.b41.place(relx=0.025, rely=0.38, relwidth=0.215, relheight=0.108, anchor='nw') self.b42 = myButton(self, text=" + ", font=("", 32), command=lambda *args: self.clicked(13)) self.b42.place(relx=0.268, rely=0.38, relwidth=0.215, relheight=0.108, anchor='nw') self.b43 = myButton(self, text=" + ", font=("", 32), command=lambda *args: self.clicked(14)) self.b43.place(relx=0.515, rely=0.38, relwidth=0.215, relheight=0.108, anchor='nw') self.b44 = myButton(self, text=" + ", font=("", 32), command=lambda *args: self.clicked(15)) self.b44.place(relx=0.76, rely=0.38, relwidth=0.215, relheight=0.108, anchor='nw') self.b51 = myButton(self, text=" + ", font=("", 32), command=lambda *args: self.clicked(16)) self.b51.place(relx=0.025, rely=0.502, relwidth=0.215, relheight=0.108, anchor='nw') self.b52 = myButton(self, text=" + ", font=("", 32), command=lambda *args: self.clicked(17)) self.b52.place(relx=0.27, rely=0.502, relwidth=0.215, relheight=0.108, anchor='nw') self.b53 = myButton(self, text=" + ", font=("", 32), command=lambda *args: self.clicked(18)) self.b53.place(relx=0.515, rely=0.502, relwidth=0.215, relheight=0.108, anchor='nw') self.b54 = myButton(self, text=" + ", font=("", 32), command=lambda *args: self.clicked(19)) self.b54.place(relx=0.761, rely=0.502, relwidth=0.215, relheight=0.108, anchor='nw') self.b61 = myButton(self, text=" + ", font=("", 32), command=lambda *args: self.clicked(20)) self.b61.place(relx=0.025, rely=0.625, relwidth=0.215, relheight=0.108, anchor='nw') self.b62 = myButton(self, text=" + ", font=("", 32), command=lambda *args: self.clicked(21)) self.b62.place(relx=0.27, rely=0.625, relwidth=0.215, relheight=0.108, anchor='nw') self.b63 = myButton(self, text=" + ", font=("", 32), command=lambda *args: self.clicked(22)) self.b63.place(relx=0.515, rely=0.625, relwidth=0.215, relheight=0.108, anchor='nw') self.b64 = myButton(self, text=" + ", font=("", 32), command=lambda *args: self.clicked(23)) self.b64.place(relx=0.76, rely=0.625, relwidth=0.215, relheight=0.108, anchor='nw') self.b71 = myButton(self, text=" + ", font=("", 32), command=lambda *args: self.clicked(24)) self.b71.place(relx=0.025, rely=0.748, relwidth=0.215, relheight=0.108, anchor='nw') self.b72 = myButton(self, text=" + ", font=("", 32), command=lambda *args: self.clicked(25)) self.b72.place(relx=0.272, rely=0.748, relwidth=0.215, relheight=0.108, anchor='nw') self.b73 = myButton(self, text=" + ", font=("", 32), command=lambda *args: self.clicked(26)) self.b73.place(relx=0.515, rely=0.748, relwidth=0.215, relheight=0.108, anchor='nw') self.b74 = myButton(self, text=" + ", font=("", 32), command=lambda *args: self.clicked(27)) self.b74.place(relx=0.76, rely=0.748, relwidth=0.215, relheight=0.108, anchor='nw') self.b81 = myButton(self, text=" + ", font=("", 32), command=lambda *args: self.clicked(28)) self.b81.place(relx=0.025, rely=0.87, relwidth=0.215, relheight=0.108, anchor='nw') self.b82 = myButton(self, text=" + ", font=("", 32), command=lambda *args: self.clicked(29)) self.b82.place(relx=0.27, rely=0.87, relwidth=0.215, relheight=0.108, anchor='nw') self.b83 = myButton(self, text=" + ", font=("", 32), command=lambda *args: self.clicked(30)) self.b83.place(relx=0.517, rely=0.87, relwidth=0.215, relheight=0.108, anchor='nw') self.b84 = myButton(self, text=" + ", font=("", 32), command=lambda *args: self.clicked(31)) self.b84.place(relx=0.76, rely=0.87, relwidth=0.215, relheight=0.108, anchor='nw') self.lst = [self.b11, self.b12, self.b13, self.b14, self.b21, self.b22, self.b23, self.b24, self.b31, self.b32, self.b33, self.b34, self.b41, self.b42, self.b43, self.b44, self.b51, self.b52, self.b53, self.b54, self.b61, self.b62, self.b63, self.b64, self.b71, self.b72, self.b73, self.b74, self.b81, self.b82, self.b83, self.b84]