How to use pygame and kivy

  Kiến thức lập trình

My question is not how to merge pygame and kivy screens. My problem is that I am working using kivy but in my code I added a function which runs a pygame program. When this program runs, the screen size remains the same as I defined it in the pyga code but all the items in the pygame screen shrink a bit in size and move a little bit top-left
Another problem is that when the both screens( kivy and pygame) run, they don’t respond to click on the close button.

Here’s some code


class Corrections(Screen):

    pass

class Correc(BoxLayout):

    def _init_(self,**kwargs):

        self.pp=open("corrections.txt","r")

        super()._init_(**kwargs)

        self.orientation="vertical"

        self.spacing=dp(5)

        self.pos_hint={"top":1}

        for i, line in enumerate(self.pp.readlines()):

            b = Button(text=line, size_hint=(.8, None), pos_hint={"x": .1}, height=(dp(40)),

                       on_press=lambda x:self.transit())

            self.add_widget(b)

    def opener(self, line):

        u = "C:myowncomputerAssassin simulate" + line.rstrip("n")+".pdf"

        u = u.rstrip('n')

        os.startfile(u)

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT