Python 2.7 当我尝试使用弹出窗口时,“警告,在下一帧之前完成了太多迭代”。我把text_size:self.size放在一个标签上,注释掉了它,它成功了。谢谢@很高兴听到这个消息! def listCleaner(self): try: for

Python 2.7 当我尝试使用弹出窗口时,“警告,在下一帧之前完成了太多迭代”。我把text_size:self.size放在一个标签上,注释掉了它,它成功了。谢谢@很高兴听到这个消息! def listCleaner(self): try: for,python-2.7,kivy,Python 2.7,Kivy,当我尝试使用弹出窗口时,“警告,在下一帧之前完成了太多迭代”。我把text_size:self.size放在一个标签上,注释掉了它,它成功了。谢谢@很高兴听到这个消息! def listCleaner(self): try: for mdw in lItem: self.the_mLv.adapter.data.remove(mdw) except ValueError: pass #


当我尝试使用弹出窗口时,“警告,在下一帧之前完成了太多迭代”。我把text_size:self.size放在一个标签上,注释掉了它,它成功了。谢谢@很高兴听到这个消息!
def listCleaner(self):
    try:
        for mdw in lItem:
            self.the_mLv.adapter.data.remove(mdw)                
    except ValueError:
        pass
    #Reload list
    self.listLoader()
def listLoader(self):
    mslFile = os.path.isfile(mgs.strip() + "mylist.txt")
    if mslFile == True:
        with open(mgs.strip() + "mylist.txt", "r") as info:
        try:
            global lItem
            lItem = [items.strip() for items in info]
            self.the_mLv.adapter.data.extend(lItem)
            info.close()
        except IndexError:
            pass
    elif mslFile == False:
        pass
def yesToRemove(self):
    with open(mgs.strip() + "mylist.txt", "r") as mLst:
        remove = [itemSelected] #a global variable
        tempLst = [ ]
        for line in mLst:
            for iS in remove:
                if iS in line:
                    line = line.replace(iS, ' ')
                    line = line.strip()
            tempLst.append(line)
        mLst.close()

    #Writing back the changes to "mylist.txt"
    with open(mgs.strip() + "mylist.txt", "w") as lstWb:
        for line in tempLst:
            lstWb.write(line)
        lstWb.close()

    #Re-load shopping list
    #Got to find a workaround        
    mSlReload = mgsApp() 
    mSlReload.listCleaner()

    #Check filesize of "mylist.txt"
    mLfs = os.stat(mgs.strip() + "mylist.txt")
    mLActual = mLfs.st_size

    if mLActual > 1:
        pass
    else:        
        #Remove mylist.txt
        listDone = lstFinalRemove()
        listDone.open()
mSlReload = mgsApp() 
mSlReload.listCleaner()
class mgsAppApp(App):

    def build(self):
        self.main_screen = mgsApp()
        return self.main_screen        

    def initilize_global_vars(self, *args):
        #This gives me a place on Android, to
        #write and store files to.
        global mgs
        root_folder = self.user_data_dir
        mgs = os.path.join(root_folder, ' ')

    def on_start(self):
        Clock.schedule_once(self.initilize_global_vars, -1)
        Clock.schedule_once(self.main_screen.accountChk, -1)
        Clock.schedule_once(self.main_screen.lastLst_global, -1)   

if __name__ == '__main__':
    mgsAppApp().run()
import kivy
kivy.require('1.9.0')

from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.popup import Popup
from kivy.lang import Builder

Builder.load_string('''

<popuptest>:
    # POPUP test
    size_hint: .8, .47
    auto_dismiss: False
    title: "Popup Test"
    BoxLayout:
        orientation: "vertical"
        padding: 40
        spacing: 40  
        Button:
            text: "Print to console"
            height: 40
            width: 130
            size_hint: (None, None)
            pos_hint: {'center_x': 0.5}
            on_press: root.printMe()
        Label:
            text: " "
        Button:
            text: "Close"
            height: 40
            width: 80
            size_hint: (None, None)
            pos_hint: {'center_x': 0.5}
            on_release: root.dismiss()

<mgsApp>:
    canvas:
        Color:
            rgba: .200, .235, .235, 1
        Rectangle:
            pos: self.pos
            size: self.size
    orientation: "vertical"
    ActionBar:
        ActionView:
            use_seperator: True
            ActionPrevious:
                title: "Test App"
                with_previous: False            
            ActionButton:
                text: "Print to console"
                on_press: root.itemHandler()
            ActionButton:                
                text: "Open Popup"
                on_release: root.openPopup()
    Label:
        text: ' '
        text_size: self.size


''')

class popuptest(Popup):

    def printMe(self):
        #This should cause too much iteration!
        printing = mgsApp()
        printing.itemHandler()

class mgsApp(BoxLayout):

    def itemHandler(self):
        #print to the console
        print "Testing 123"

    def openPopup(self):
        popupWindow = popuptest()
        popupWindow.open()

class mgsAppApp(App):

    def build(self):
        self.main_screen = mgsApp()
        return self.main_screen

if __name__ == '__main__':
mgsAppApp().run()
<mgsApp>:
    name: "mgs"
    the_mLv: id_mLv
    # https://stackoverflow.com/questions/29882870/
    # how-to-position-boxlayout-to-top-of-screen
    canvas:
        Color:
            rgba: .200, .235, .235, 1
        Rectangle:
            pos: self.pos
            size: self.size
    orientation: "vertical"
    ActionBar:
        ActionView:
            use_seperator: True
            ActionPrevious:
                title: "My Go Shopping"
                with_previous: False
                app_icon: "icon_tray.png"            
            ActionButton:
                text: "Got!"
                on_press: root.itemHandler()
            ActionButton:                
                text: "Refresh"
                on_release: root.listCleaner()
            ActionOverflow:
                ActionButton:
                    text: "New List"
                    #text_size: self.size
                    on_press: root.chkForNewList()
                ActionButton:
                    text: "Check Server"
                    #text_size: self.size
                    on_press: root.accountToServer()
                ActionButton:
                    text: "Logout"
                    #text_size: self.size
                    on_press: root.accountRemove()

    ListView:
        id: id_mLv
        adapter:
            ListAdapter(
            data=[ ],
            selection_mode="single",
            allow_empty_selection=True,
            cls=ListItemButton)