mensilikon.blogg.se

Tkinter image resize
Tkinter image resize










tkinter image resize
  1. #Tkinter image resize install
  2. #Tkinter image resize full
  3. #Tkinter image resize code

Width = vid.get(cv2.CAP_PROP_FRAME_WIDTH) M_player.music_control(m_file,False,-1,0) M_player.music_control("project_media\\signal.ogg",True,-1,0) M_player.music_control("project_media\\signal.ogg",False,-1,0) # stopping vid_music and starting game music Return(ret,cv2.cvtColor(frame,cv2.COLOR_BGR2RGB))

#Tkinter image resize code

Here is the code for the video player: from tkinter import *įrom Scripts.music_player import m_playerĭef player(self,vid_file,m_file,nxt_func): I know that I can implement something similar by resizing the frames, in my code to play the video, but I cant seem to figure out a quick, efficient a way to do so. Here, self.bg_image is the image to be displayed as background and self.bg_label is the label that displays the image. Self.bg_label = Label(self,image=bg_image) I've bound this function to the label that displays the background image like this: self.bg_image = Image.open("project_pics\\start_pg.png")īg_image = ImageTk.PhotoImage(self.bg_image) Image = self.bg_image.resize((width,height)) Width, height = self.winfo_width(), self.winfo_height() Here it is: def resizeimage(self,event) : The same goes for the background images I used in different pages but I wrote a piece of code to resize the background images to screen size. But I've noticed that when I play the game in a different computers, since the screen sizes are different, the video doesn't fit exactly to screen size like I want it to.

tkinter image resize

Its part of a game I've made and compiled into an application. Ms.showerror('Error!','File type is unsupported.I've written a piece of code to play a video using OpenCV on tkinter.

#Tkinter image resize full

So full coding part is here :- from tkinter import * In this function, we save the file uploaded by the user in the File variable if the file is supported we show the picture after resizing it if the file is not supported then we simply tell the user that the file is not supported. Ms.showerror('Error!','File type is unsupported.') In this function, we have mainly designed the look of our GUI def make_image(self): Txt = ''' By Shrimad Mishra on behaf of CodeSpeedy ''' Self.canvas = Canvas(self.master,height=s,width=s, bg='Black',bd=10,relief='ridge') This is the init function inside our class Image_Viewer, when we make an object of our class this init function will be the function that will be invoked first implicitly and set the size of windows as per given, set the image as none. So let’s move to the module-wise or function-wise explanation of the program.

#Tkinter image resize install

To install this pillow in your system use:-īefore continuing please go through these two modules specially Tkinter because we will use two more features of Tkinter.Īlso, take some knowledge about the class and object because we need this. We are going to use a special module pillow that helps to manipulate the image.

tkinter image resize tkinter image resize

Tkinter is an inbuilt module in Python by which you can make a GUI. In this post, we are going to build an Image Viewer In Python Using Tkinter.












Tkinter image resize