我試圖顯示一個彈出窗口,以防今天是數(shù)據(jù)庫上的日期。問題是彈出窗口,但它似乎是在主屏幕后面構建的。我認為這是由于在“on_enter”方法上調用的,但無法解決此問題。請注意,此“設置”按鈕是從主屏幕而不是彈出窗口本身呈現(xiàn)的。這是我的 kv 文件:#:import Factory kivy.factory.Factory<ScreenManager>:<DiaDeRevisao@Popup>: title: 'Aten??o dia de revis?o' auto_dismiss: False size_hint:0.7,0.7 BoxLayout: canvas.before: Color: rgba:(1,1,1,1) Rectangle: size: self.size pos: self.pos BoxLayout: orientation:'vertical' MDLabel: text:'Hoje é dia de revis?o' Button: text: 'OK' on_press: root.dismiss()<FileChooserPop@Popup>: title:'Escolha o arquivo de audio MP3' BoxLayout: canvas.before: Color: rgba:(0,0,0,0.35) Rectangle: size: self.size pos: self.pos orientation: 'vertical' BoxLayout: size_hint_y: None height: sp(52) Button: text: 'Icon View' on_press: fc.view_mode = 'icon' Button: text: 'List View' on_press: fc.view_mode = 'list' FileChooser: id: fc FileChooserIconLayout FileChooserListLayout BoxLayout: size_hint_y: None MDTextButton: size_hint_x:0.4 text: 'Voltar' on_press: root.dismiss() MDIconButton: halign:'center' icon:'content-save' on_press:root.selected(fc.path, fc.selection) on_release: root.manager.current = 'Principal'<Main>: BoxLayout: orientation:"vertical" spacing:'50dp' padding:'70dp' BoxLayout: MDTextButton: text: 'Revis?es' on_press: root.manager.current = 'Revisoes'# on_release:Factory.FileChooserPop().open()這很奇怪,我無法弄清楚。我很感激任何幫助。干杯!
1 回答

撒科打諢
TA貢獻1934條經(jīng)驗 獲得超2個贊
問題是該on_enter()
事件觸發(fā)得太早,因此它Popup
會在Main
Screen
. 您可以通過在顯示Popup
. 我改變:
Factory.DiaDeRevisao().open()
到:
Clock.schedule_once(lambda dt: Factory.DiaDeRevisao().open())
將提供延遲并允許Popup
顯示在 的頂部Screen
。
添加回答
舉報
0/150
提交
取消