Уведомления

Группа в Telegram: присоединиться

#1 Сен. 16, 2018 17:35:58

Bloodies
Зарегистрирован: 2018-09-16
Сообщения: 2
Репутация: +  0  -
Профиль   Отправить e-mail  

Как это сделать???

Нужно увеличить максимально Frame, чтобы он был на все приложение
и чтоб туда можно было добавить свой текст или изображения.

from tkinter import *
import tkinter
import tkinter.ttk

def create_widgets_in_first_frame():
# Create the label for the frame


# Create the button for the frame
first_window_next_button = tkinter.Button(first_frame, text=“1”, command=call_second_frame_on_top)
first_window_next_button.grid(column=0, row=0, pady=10, padx=10, stickytkinter.N))
first_window_next_button = tkinter.Button(first_frame, text=“2”, command=call_third_frame_on_top)
first_window_next_button.grid(column=0, row=1, pady=10, padx=10, stickytkinter.N))
first_window_next_button = tkinter.Button(first_frame, text=“3”, command=call_fourth_frame_on_top)
first_window_next_button.grid(column=1, row=0, pady=10, padx=10, stickytkinter.N))
first_window_next_button = tkinter.Button(first_frame, text=“4”, command=call_fifth_frame_on_top)
first_window_next_button.grid(column=1, row=1, pady=10, padx=10, stickytkinter.N))
first_window_quit_button = tkinter.Button(first_frame, text=“Exit”, command=quit_program)
first_window_quit_button.grid(column=2, row=2, pady=10, padx=10, stickytkinter.N))


def create_widgets_in_second_frame():
# Create the label for the frame


# Create the button for the frame
second_window_back_button = tkinter.Button(second_frame, text=“1”, command=call_first_frame_on_top)
second_window_back_button.grid(column=0, row=1, pady=10, padx=10, stickytkinter.N))
second_window_next_button = tkinter.Button(second_frame, text=“Next”, command=quit_program)
second_window_next_button.grid(column=1, row=1, pady=10, padx=10, stickytkinter.N))

def create_widgets_in_third_frame():
# Create the label for the frame

# Create the button for the frame
third_window_back_button = tkinter.Button(third_frame, text=“1”, command=call_first_frame_on_top)
third_window_back_button.grid(column=0, row=1, pady=10, padx=10, stickytkinter.N))
third_window_quit_button = tkinter.Button(third_frame, text=“Quit”, command = quit_program)
third_window_quit_button.grid(column=1, row=1, pady=10, padx=10, stickytkinter.N))

def create_widgets_in_fourth_frame():
# Create the label for the frame

# Create the button for the frame
fourth_window_back_button = tkinter.Button(fourth_frame, text=“1”, command=call_first_frame_on_top)
fourth_window_back_button.grid(column=0, row=1, pady=10, padx=10, stickytkinter.N))
fourth_window_quit_button = tkinter.Button(fourth_frame, text=“Quit”, command=quit_program)
fourth_window_quit_button.grid(column=1, row=1, pady=10, padx=10, stickytkinter.N))

def create_widgets_in_fifth_frame():
# Create the label for the frame

# Create the button for the frame
fifth_window_back_button = tkinter.Button(fifth_frame, text=“1”, command=call_first_frame_on_top)
fifth_window_back_button.grid(column=0, row=1, pady=10, padx=10, stickytkinter.N))
fifth_window_quit_button = tkinter.Button(fifth_frame, text=“Quit”, command=quit_program)
fifth_window_quit_button.grid(column=1, row=1, pady=10, padx=10, stickytkinter.N))

def call_first_frame_on_top():
# This function can be called only from the second window.
# Hide the second window and show the first window.
second_frame.place_forget()
third_frame.place_forget()
fourth_frame.place_forget()
fifth_frame.place_forget()
first_frame.place(relx=0.3, rely=0.3)

def call_second_frame_on_top():
# This function can be called from the first and third windows.
# Hide the first and third windows and show the second window.
first_frame.place_forget()
second_frame.place(relx=0.3, rely=0.3)

def call_third_frame_on_top():
# This function can only be called from the second window.
# Hide the second window and show the third window.
first_frame.place_forget()
third_frame.place(relx=0.3, rely=0.3)

def call_fourth_frame_on_top():
# This function can only be called from the second window.
# Hide the second window and show the third window.
first_frame.place_forget()
fourth_frame.place(relx=0.3, rely=0.3)

def call_fifth_frame_on_top():
# This function can only be called from the second window.
# Hide the second window and show the third window.
first_frame.place_forget()
fifth_frame.place(relx=0.3, rely=0.3)

def quit_program():
root_window.destroy()

###############################
# Main program starts here #
###############################

# Create the root GUI window.
root_window = tkinter.Tk()

root_window.title(“Калькулятор квадратов”)
root_window.geometry(“750x450+300+200”)
root_window.resizable(False, False)


# Create frames inside the root window to hold other GUI elements. All frames must be created in the main program, otherwise they are not accessible in functions.
first_frame = tkinter.ttk.Frame(root_window, width=750, height=450+300+200)
first_frame.place(relx=0.3, rely=0.3)

second_frame = tkinter.ttk.Frame(root_window, width=750, height=450+300+200)
second_frame.place(relx=0.3, rely=0.3)

third_frame = tkinter.ttk.Frame(root_window, width=750, height=450+300+200)
third_frame.place(relx=0.3, rely=0.3)

fourth_frame = tkinter.ttk.Frame(root_window, width=750, height=450+300+200)
fourth_frame.place(relx=0.3, rely=0.3)

fifth_frame = tkinter.ttk.Frame(root_window, width=750, height=450+300+200)
fifth_frame.place(relx=0.3, rely=0.3)

# Create all widgets to all frames
create_widgets_in_first_frame()
create_widgets_in_second_frame()
create_widgets_in_third_frame()
create_widgets_in_fourth_frame()
create_widgets_in_fifth_frame()


# Hide all frames in reverse order, but leave first frame visible (unhidden).
second_frame.place_forget()
third_frame.place_forget()
fourth_frame.place_forget()
fifth_frame.place_forget()

# Start tkinter event - loop
root_window.mainloop()

Офлайн

#2 Сен. 18, 2018 21:45:10

DamMercul
Зарегистрирован: 2017-11-26
Сообщения: 222
Репутация: +  6  -
Профиль   Отправить e-mail  

Как это сделать???

А код в теги уже грех?



____________________________________________________

 # Life loop
while alive:
    if (fun > boredom) and money:
        pass_day(fun, boredom, money)
        continue
    else: break

Офлайн

Board footer

Модераторировать

Powered by DjangoBB

Lo-Fi Version