This is my code
import turtle
scr = turtle.Screen()
When I run it the screen appears and then disappears, what am I doing wrong?
Add scr.mainloop() at the end of your code.
Related
I want to see my kivy application compiled with Buildozer on an android phone without seeing the navigation bar and the phone time .
I try:
from kivy.config import Config
Config.set('graphics', 'borderless', '1')
Config.set('graphics', 'fullscreen', 'True')
from kivy.core.window import Window
Window.show()
When creating a kivy exe on Windows with Pyinstaller, I still have the right click creating red dot.
Why does right-clicking create an orange dot in the center of the circle? proposed to use this to remove this behavior.
from kivy.config import Config
Config.set('input', 'mouse', 'mouse,multitouch_on_demand')
But when I do, I can't scroll anymore on my page if I stay pressed on a widget.
Isn't there something more precise like deactivate_red_dot rather than deactivated_multitouch which seems to have side effects ? Maybe a method of the Mouse() that we can override ?
venv/Lib/site_packages/kivy/input/providers/mouse.py
Method on_mouse_press
Replace
do_graphics = (not self.disable_multitouch) and (
button != 'left' or 'ctrl' in modifiers)
By
do_graphics = False
I'm not sure if I won't have others sides effects but that seems legit by the behavior I saw on the code.
EDIT:
Actually for my project, the bug with disable multitouchh was on android so I did:
if isWindows():
from kivy.config import Config
Config.set('input', 'mouse', 'mouse,disable_multitouch')
Good side, doesn't change fundamental library. Bad side, disabling multitouch could lead to others sneaky bugs.
I create tests using Appium+Python to test IOs app.
I want to scroll the page.
Here is the code
def scroll_page(self):
action = TouchAction(self)
action.press(BrowsePageElements.firs_element_to_scroll(self)).
move_to(BrowsePageElements.second_element_to_scroll(self)).perform()
When I'm trying to run this function, I get an error
error screenshot
Could you help me to find out, how to fix this error?
Appium Python has a native scroll function. It works for both Android and iOS.
driver.scroll(origin_el, destination_el, duration=None), where duration is an optional argument. This function scrolls origin_el to the location of destination_el.
Link to scroll source code
The Appium documentation is rather spotty and needs updating. However, the source code is documented well enough to understand and learn the program.
This currently works for me:
...
SCROLL_DUR_MS = 3000
...
window_size = self.driver.get_window_size()
self.scroll_y_top = window_size['height'] * 0.2
self.scroll_y_bottom = window_size['height'] * 0.8
self.scroll_x = window_size['width'] * 0.5
...
def scroll_up(self):
self._y_scroll(self.scroll_y_top, self.scroll_y_bottom)
def scroll_down(self):
self._y_scroll(self.scroll_y_bottom, self.scroll_y_top)
def _y_scroll(self, y_start, y_end):
actions = TouchAction(self.driver)
actions.long_press(None, self.scroll_x, y_start, SCROLL_DUR_MS)
actions.move_to(None, self.scroll_x, y_end)
actions.perform()
It scrolls slowly over 3s because I want it to be controlled, but you could shorten SCROLL_DUR_MS (the duration of the scroll action in milliseconds) if you want something more zoomy. I also went away from using elements as the start and/or end points because I wanted something general that would work with any screen content.
For scroll_y_top and scroll_y_bottom I picked 20% in from the top and bottom of the screen just to make sure I wasn't hitting anything at the borders (like the navigation bar at the top of iOS Preferences or an info bar at the bottom of the app I was working in). I also ran into a "bug" where it wasn't scrolling when I left scroll_x as 0, but it turns out that it wasn't registering the left edge as inside the scrolling area for the app I was working in.
Hope this helps.
In the past when i've run into issues scrolling for one reason or another, I've simply swiped using coordinates to scroll down the page.
self.driver.swipe(100, 700, 100, 150)
I want to zoom image in blackberry torch.For this i am using ZoomScreen predefined class.It working but my problem is i need a screen which can contain header,some text and then one image which can be zoom in and out.
Thank you
ZoomScreen extends MainScreen, so you can set a title and a status for it by adding setTitle() and setStatus() functions. You can use normal adds too. Did you try this and did not work?
how to add a activity screen to a button click event ?
ActivityIndicatorView view = new ActivityIndicatorView(Field.FIELD_HCENTER);
Bitmap spinImage = Bitmap.getBitmapResource("spinner.png");
view.createActivityImageField(spinImage,6,0);
LabelField label = new LabelField("Loading Hockey...");
s.add(label);
s.add(view);
pushScreen(s);
by this code, it will shows error. ie no import package
how to solve this ?
Are you importing all the right packages? i.e.
import net.rim.device.api.ui.component.progressindicator.*;
import net.rim.device.api.ui.*;
and so on....