ujwala patil
ujwala patil

Reputation: 49

Can I Use Tkinter window in Kivy as a sub-part of GUI?

I am new to kivy and Tkinter.

I want to use kivy as my root (main) GUI. But I also want to add Tkinker in it as a sub-part.

is it possible to integrate (fix) tkinter window in kivy GUI as sub part ???

example :

kivy code :

from kivy.app import App
from kivy.uix.image import Image

class MyApp(App):
  def build(self):
    return Image(source="./Logo.png")

MyApp().run()

kivy output :

kivy output

Tkinter code :

import tkinter
window = tkinter.Tk()
window.title("GUI")

tkinter.Label(window, text = "Username").grid(row = 0) 
tkinter.Entry(window).grid(row = 0, column = 1) 
tkinter.Label(window, text = "Password").grid(row = 1)
tkinter.Entry(window).grid(row = 1, column = 1) 
tkinter.Checkbutton(window, text = "Keep Me Logged In").grid(columnspan = 2)

window.mainloop()

tkinter output :

thinter output

expected output :

expected output

I tried to integrate both code, but it execute one after another. any way to add tkinter window in kivy GUI.

Upvotes: 1

Views: 3220

Answers (2)

inclement
inclement

Reputation: 29450

It probably is possible to run Kivy in an opengl context within a tkinter window, but there's no support for this and you'd have to write a fair amount of code to get it to work. Essentially you'd need to write a tkinter backend provider for the Kivy window.

I wouldn't recommend this, it would be much easier to do everything within one framework.

Upvotes: 1

Dejan Dakovic
Dejan Dakovic

Reputation: 155

It's not possible to kivy window load tk. But you can try make as two programs with statick positions (but that is hardway), or just see how to write all code in one framework

Upvotes: 1

Related Questions