what should we code if we want frame 1 as default and frame 2 , 3 should be under a menu button . when we click the menu button , i should get 2 options (frame 2 and frame 3) and when clicked the frame 2 or 3 , still the menu should be available and when we are in frame 2 or frame 3 , the menu button should show frame 1 so that i can go back to frame 1 . please reply the code or make a video on it in short term . pls
You would have to create a menu bar and add the those two options to it. When a user clicks on the frame 2 option, for example, you would use the show_frame function to take them to that page. Doesn't seem too difficult
Awesome video, python, java, flutter, which language I should choose to create a GUI app for rasbian (virtual environment), I want to create an app on my windows pc, and when it's done I just want to test how it is working in rasbian and than in real raspberry pi 4. I don't want to install any additional module from the terminal, I want something that can directly run on rasbian
Hey, thanks for the idea. I am trying to use it where I have 3 frames at a time on a screen and I just want to update only one frame but it isn't working for me? Can you please help
With Python you can use Kivy to make apps, although I don't know how to use it. I personally use Java with Android studio to make apps. Yes, Java can be more confusing than Python being that it's entirely based on object oriented programming. Hope this helps
@@codefoxx I know the basis of POO from c++ (I guess is kinda same) but Java seems more complex for me. Anyway thanks for the information, I'll keep it in mind.
@@ChicaRara01 nice, I recommend you use OOP because if you want to make something other than a beginner program, respectively, (something more complex with a lot of functionality) you will need OOP because it will give your code a better structure and it will help keep it organized when you get into the several hundred/ thousands lines of codes. It will also make it easier to add or delete things from your project!
Hi bro, loved the video. Just a question tho, how can i make it like full size? In the intro you've got like these big frames but in the video they are small. Thanks
Instead of (fill="x") use (fill="both" expand="true") when you pack the Label. You can add as many things as you want per frame, I just used the Label and button on each frame to demonstrate how it works
@@sairsc8043 I do something similar to what you want in this video, if you still need help, email me ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-2V2QxFBMEyo.html
can I ask u a question? can I double the layer without actually changing the back layer, for example, I have 2 layers, the first layer is the main layer, the second layer is like 'pop up' image with the blurry main layer behind it(without actually changing the data in the main layer)?
I have a problem. It says, can't invoke pack command the application has been destroyed and I don't know why. ¿Cuold you help me to figure out what is wrong or what am I missing? from tkinter import * import time #----------------------SHOW FRAMES------------------------- def show_frame(frame): frame.tkraise() window=Tk() window.title("PPA") window.config(bg="white") window.state("zoomed") frame1=Frame(window) frame2=Frame(window) frame3=Frame(window) for frame in (frame1,frame2,frame3): frame.pack() frame1.config(bg="blue") boton=Button(frame,width=10,height=2, relief="raised", text="SUBJECTS",fg="white",command=lambda:show_frame(frame2)) boton1.pack() frame2.config(bg="black") boton2=Button(frame,width=10,height=2, relief="raised", text="CALCULATOR",fg="white",command=lambda:show_frame(frame3)) boton2.pack() frame3.config(bg="red") boton3=Button(frame,width=10,height=2, relief="raised", text="MAIN MENU",fg="white",command=lambda:show_frame(frame1)) boton3.pack() window.mainloop()
@@ChicaRara01 Ok, there was a lot of things missing from your code, for example, you didn't import the tkinter module nor did you call on the show_frame function. I fixed your code although I am not 100% sure what your aiming for in this project. I added a button to each of the frames. Below is the code import tkinter as tk def show_frame(frame): frame.tkraise() window=tk.Tk() window.title("PPA") window.config(bg="white") window.state("zoomed") window.rowconfigure(0, weight=1) window.columnconfigure(0, weight=1) frame1=tk.Frame(window) frame2=tk.Frame(window) frame3=tk.Frame(window) for frame in (frame1,frame2,frame3): frame.grid(row=0,column=0,sticky='nsew') frame1.config(bg="blue") boton1=tk.Button(frame1,width=10,height=2, relief="raised", text="SUBJECTS",fg="white",command=lambda:show_frame(frame2)) boton1.pack() frame2.config(bg="black") boton2=tk.Button(frame2,width=10,height=2, relief="raised", text="CALCULATOR",fg="white",command=lambda:show_frame(frame3)) boton2.pack() frame3.config(bg="red") boton3=tk.Button(frame3,width=10,height=2, relief="raised", text="MAIN MENU",fg="white",command=lambda:show_frame(frame1)) boton3.pack() show_frame(frame1) window.mainloop()
@@codefoxx not pretty sure why didn't work if before trying to switch between frames(I made a simple interface with just one frame and it worked perfectly) but thank u, I really appreciate. Anyway you got a new subscriber since a saw your video for the first time. Great job.
If you haven't, make a function call to show_frame(frame1), at the bottom of the program. That should make frame1, the one that shows up when you run the project
Uh.. looks like I have more problem. If I add sticky = 'nsew', there's nothing appear on the program. But if I get rid of it, the title, button and etc were appeared. So the difference between my code and your code on your tutorial video, I add entry in the frames. So, is that the one causing the problem?
@@hartech6162 I have not coded with Python in months but when I did, I rarely used place. I either used grid or pack. I read that it was bad practice to use place once but not exactly sure why. Besides, nearly everything that you would want to do can be accomplished with grid and/or pack. So to answer your question, you would have to try to find out