F
F
Fizl2020-07-25 20:30:15
Python
Fizl, 2020-07-25 20:30:15

How to open a separate window in kivy?

I need to open a separate window on click on send

#!/usr/bin/env python
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.anchorlayout import AnchorLayout
from kivy.uix.label import Label
from kivy.uix.textinput import TextInput
from kivy.uix.gridlayout import GridLayout
import codecs
from kivy.uix.button import Button
from kivy.config import Config
from kivy.uix.scrollview import ScrollView
from kivy.core.window import Window
from kivy.uix.modalview import ModalView

MAX_SIZE = (1200, 800)
Config.set('graphics', 'width', MAX_SIZE[0])
Config.set('graphics', 'height', MAX_SIZE[1])

Builder.load_string("""#:kivy 1.4.0
<Widgets>:
  Scr1:
    name: '1'
    AnchorLayout:
      #FloatLayout:
      #	Label:
      #		text:'ЗНАЧЕНИЕ'
      #		bold:True
      #		size_hint:0.2,0.1
      #		pos:650,300
        #        color: 102,102,102,0.3
         #       canvas.before:
          #          Color:
           #             rgba: 102,102,102,0.3
            #        Rectangle:
             #           pos: self.pos
              #          size: self.size
      FloatLayout:
        Label:
                color: 102,102,102,0.3
                canvas.before:
                    Color:
                        rgba: 102,102,102,0.3
                    Rectangle:
                        pos: self.pos
                        size: self.size
          
        Button:
          size_hint:0.22,0.2
          bold:True
          pos:50,600
          background_color:4,3,0,1
          color:0,0,0,2
          font_size:52
          text:'SEND'
          #on_press:root.current = '2'
        Label:
          size_hint:1,0.2
          font_size:200
          bold:True
          text:'text'
          color:0,0,0,2
          canvas.before:
            Color:
              rgba:4,3,0,1
            Rectangle:
              pos:self.pos
              size:self.size
""")


class Widgets(ScreenManager):
    pass
class Scr1(Screen):
  pass

class Scr2(Screen):
  pass

class Scr3(Screen):
  pass

class Scr4(Screen):
  pass	

class JBIApp(App):
  def on_touch_move(self, touch): 
    if self.collide_point(touch.x, touch.y): 
      self.pos=[touch.x-25, touch.y-25] 
  def build(self):
    return Widgets()

if __name__=='__main__':
  JBIApp().run()

Answer the question

In order to leave comments, you need to log in

1 answer(s)
U
Umpiro, 2020-07-26
@Umpiro

kivy.uix.popup ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question